I'm wanting to use gif formats for my game because the bmp files are beginning to take up a lot of space. I downloaded algif and it appears that I was able to compile the library correctly. These are the steps I took.
gcc -v algif.c
created the o file (about 3KB)
ar -rcs libalgif.a algif.o
created libalgif.a (also about 3KB)
I then copied the libalgif.a file into the compiler's lib folder, copied algif.h to the include folder, and added -libalgif to the linker thing (using dev-cpp).
using the code
#include "allegro.h" #include "algif.h" void main() { allegro_init(); algif_init(); allegro_message("hey"); }END_OF_MAIN();
I get the error:
c:\documents and settings\mark\desktop\thing2\main.o(.text+0x25):main.cpp: undefined reference to `algif_init'
I tried this with 2 other libraries and had similar issues. I also wanted to do a forum search, but it's not there anymore.
That would be: -lalgif for gcc.
-lalleg -lalgif
gives me these errors:
1 | c:\documents and settings\mark\desktop\thing2\main.o(.text+0x35):main.cpp: undefined reference to `algif_init' |
2 | C:\Dev-Cpp\Lib/libalgif.a(algif.o.b)(.text+0x11):algif.c: undefined reference to `algif_load_raw_animation' |
3 | C:\Dev-Cpp\Lib/libalgif.a(algif.o.b)(.text+0xa1):algif.c: undefined reference to `create_bitmap' |
4 | C:\Dev-Cpp\Lib/libalgif.a(algif.o.b)(.text+0xe6):algif.c: undefined reference to `blit' |
5 | C:\Dev-Cpp\Lib/libalgif.a(algif.o.b)(.text+0x101):algif.c: undefined reference to `algif_render_frame' |
6 | C:\Dev-Cpp\Lib/libalgif.a(algif.o.b)(.text+0x164):algif.c: undefined reference to `algif_destroy_raw_animation' |
7 | C:\Dev-Cpp\Lib/libalgif.a(algif.o.b)(.text+0x190):algif.c: undefined reference to `algif_load_raw_animation' |
8 | C:\Dev-Cpp\Lib/libalgif.a(algif.o.b)(.text+0x34b):algif.c: undefined reference to `create_bitmap' |
9 | C:\Dev-Cpp\Lib/libalgif.a(algif.o.b)(.text+0x35f):algif.c: undefined reference to `select_palette' |
10 | C:\Dev-Cpp\Lib/libalgif.a(algif.o.b)(.text+0x394):algif.c: undefined reference to `algif_render_frame' |
11 | C:\Dev-Cpp\Lib/libalgif.a(algif.o.b)(.text+0x3a1):algif.c: undefined reference to `unselect_palette' |
12 | C:\Dev-Cpp\Lib/libalgif.a(algif.o.b)(.text+0x3ad):algif.c: undefined reference to `algif_destroy_raw_animation' |
13 | C:\Dev-Cpp\Lib/libalgif.a(algif.o.b)(.text+0x42e):algif.c: undefined reference to `create_bitmap_ex' |
14 | C:\Dev-Cpp\Lib/libalgif.a(algif.o.b)(.text+0x49a):algif.c: undefined reference to `blit' |
15 | C:\Dev-Cpp\Lib/libalgif.a(algif.o.b)(.text+0x4b2):algif.c: undefined reference to `get_palette' |
16 | C:\Dev-Cpp\Lib/libalgif.a(algif.o.b)(.text+0x503):algif.c: undefined reference to `_imp___rgb_scale_6' |
17 | C:\Dev-Cpp\Lib/libalgif.a(algif.o.b)(.text+0x53f):algif.c: undefined reference to `_imp___rgb_scale_6' |
18 | C:\Dev-Cpp\Lib/libalgif.a(algif.o.b)(.text+0x57c):algif.c: undefined reference to `_imp___rgb_scale_6' |
19 | C:\Dev-Cpp\Lib/libalgif.a(algif.o.b)(.text+0x5bf):algif.c: undefined reference to `algif_save_raw_animation' |
20 | C:\Dev-Cpp\Lib/libalgif.a(algif.o.b)(.text+0x5d9):algif.c: undefined reference to `destroy_bitmap' |
if I switch the order to
-lalgif -lalleg
then I get these errors
c:\documents and settings\mark\desktop\thing2\main.o(.text+0x35):main.cpp: undefined reference to `algif_init' C:\Dev-Cpp\Lib/libalgif.a(algif.o.b)(.text+0x11):algif.c: undefined reference to `algif_load_raw_animation' C:\Dev-Cpp\Lib/libalgif.a(algif.o.b)(.text+0x101):algif.c: undefined reference to `algif_render_frame' C:\Dev-Cpp\Lib/libalgif.a(algif.o.b)(.text+0x164):algif.c: undefined reference to `algif_destroy_raw_animation' C:\Dev-Cpp\Lib/libalgif.a(algif.o.b)(.text+0x190):algif.c: undefined reference to `algif_load_raw_animation' C:\Dev-Cpp\Lib/libalgif.a(algif.o.b)(.text+0x394):algif.c: undefined reference to `algif_render_frame' C:\Dev-Cpp\Lib/libalgif.a(algif.o.b)(.text+0x3ad):algif.c: undefined reference to `algif_destroy_raw_animation' C:\Dev-Cpp\Lib/libalgif.a(algif.o.b)(.text+0x5bf):algif.c: undefined reference to `algif_save_raw_animation'
If that's really a .a file full of .o's, then you include it in the project (like a .c file) without linking to it.
ah, I misread the manual!
gcc -c *.c
ar -rcs libalgif.a *.o
I interperetd this as
gcc -v algif.c
ar -rcs libalgif.a algif.o
so when you said "a .a file full of .o's" I caught the idea that there were multiple files at work here... since I really have no idea what's going on with libs, linking, .o, .a, makefiles, and all that. It's working now, thanks alot!
By the way, is it possible to get the forum search back? I can't find forum topics as easily with google.
It's still there if you use the search lin on the main page. Theres a link at the top of the search to use the original search.
that one's gone too. links to www.allegro.cc/forums/search/googlepwnage