- Online Community Forums » Installation, Setup & Configuration » Algif, or any gif library for that matter

Credits go to Matthew Leverton for helping out!
This thread is locked; no one can reply to it. rss feed Print
Algif, or any gif library for that matter
Mark Oates
Member #1,146
March 2001

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()



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. :-/

Matthew Leverton
Supreme Loser
January 1999

That would be: -lalgif for gcc.

Mark Oates
Member #1,146
March 2001

-lalleg -lalgif

gives me these errors:

1c:\documents and settings\mark\desktop\thing2\main.o(.text+0x35):main.cpp: undefined reference to `algif_init'
2C:\Dev-Cpp\Lib/libalgif.a(algif.o.b)(.text+0x11):algif.c: undefined reference to `algif_load_raw_animation'
3C:\Dev-Cpp\Lib/libalgif.a(algif.o.b)(.text+0xa1):algif.c: undefined reference to `create_bitmap'
4C:\Dev-Cpp\Lib/libalgif.a(algif.o.b)(.text+0xe6):algif.c: undefined reference to `blit'
5C:\Dev-Cpp\Lib/libalgif.a(algif.o.b)(.text+0x101):algif.c: undefined reference to `algif_render_frame'
6C:\Dev-Cpp\Lib/libalgif.a(algif.o.b)(.text+0x164):algif.c: undefined reference to `algif_destroy_raw_animation'
7C:\Dev-Cpp\Lib/libalgif.a(algif.o.b)(.text+0x190):algif.c: undefined reference to `algif_load_raw_animation'
8C:\Dev-Cpp\Lib/libalgif.a(algif.o.b)(.text+0x34b):algif.c: undefined reference to `create_bitmap'
9C:\Dev-Cpp\Lib/libalgif.a(algif.o.b)(.text+0x35f):algif.c: undefined reference to `select_palette'
10C:\Dev-Cpp\Lib/libalgif.a(algif.o.b)(.text+0x394):algif.c: undefined reference to `algif_render_frame'
11C:\Dev-Cpp\Lib/libalgif.a(algif.o.b)(.text+0x3a1):algif.c: undefined reference to `unselect_palette'
12C:\Dev-Cpp\Lib/libalgif.a(algif.o.b)(.text+0x3ad):algif.c: undefined reference to `algif_destroy_raw_animation'
13C:\Dev-Cpp\Lib/libalgif.a(algif.o.b)(.text+0x42e):algif.c: undefined reference to `create_bitmap_ex'
14C:\Dev-Cpp\Lib/libalgif.a(algif.o.b)(.text+0x49a):algif.c: undefined reference to `blit'
15C:\Dev-Cpp\Lib/libalgif.a(algif.o.b)(.text+0x4b2):algif.c: undefined reference to `get_palette'
16C:\Dev-Cpp\Lib/libalgif.a(algif.o.b)(.text+0x503):algif.c: undefined reference to `_imp___rgb_scale_6'
17C:\Dev-Cpp\Lib/libalgif.a(algif.o.b)(.text+0x53f):algif.c: undefined reference to `_imp___rgb_scale_6'
18C:\Dev-Cpp\Lib/libalgif.a(algif.o.b)(.text+0x57c):algif.c: undefined reference to `_imp___rgb_scale_6'
19C:\Dev-Cpp\Lib/libalgif.a(algif.o.b)(.text+0x5bf):algif.c: undefined reference to `algif_save_raw_animation'
20C:\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'

Matthew Leverton
Supreme Loser
January 1999

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.

Mark Oates
Member #1,146
March 2001

ah, I misread the manual! :)

manual said:

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. :P 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.

Member #1,548
September 2001

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.

Mark Oates
Member #1,146
March 2001

that one's gone too. links to

Go to: