Hi all, I'm hoping someone with a better understanding of make files than me can help me out
I've written some code to load 3ds models, this uses the lib3ds library file. My code works well, so I've went to make it into a .a library file, however when I do this I get an error
linker input file unused because linking not done, for all the library files (lib3ds, opengl etc.) I try to link. Strangely if I don't try to link these $(LDFLAGS) it it produces a library, but when called from project file code reports the lib3ds functions missing,but not the opengl or x11.
I would be grateful if anyone could help me with my library makefile as I'm lost. Thanks.
/******************MAKEFILE********************************/
LDFLAGS= -l3ds -L/usr/X11R6/lib -lGL -lGLU -lXxf86vm `sdl-config --cflags --libs` -lSDL_image
CC= gcc -Wall -pedantic -g -Os -ffloat-store -c
AR= ar
SOURCE_FILE= LibaryFilesVer001
OBJECTS= $(SOURCE_FILE)/SetUpScreen.o $(SOURCE_FILE)/ModelLoader.o $(SOURCE_FILE)/TextureLoader.o $(SOURCE_FILE)/simclist.o
%.o: %.c
$(CC) -o $@ $< $(LDFLAGS)
libgame.a: $(OBJECTS)
$(AR) -rs libgame.a $(OBJECTS)
clean:
@echo Cleaning up...
@echo Done.
/**************************************************************************/
I should add that if I call the .a file from an example (one which does not use LDFLAG) it gives me the following errors
LibaryFilesVer001/ModelLoader.c:100: undefined reference to `lib3ds_file_load'
LibaryFilesVer001/ModelLoader.c:174: undefined reference to `lib3ds_file_material_by_name'
LibaryFilesVer001/ModelLoader.c:244: undefined reference to `lib3ds_file_free'
collect2: ld returned 1 exit status
make: *** [all] Error 1
But if I show my symbols from the libary file these symbols exist
so nm -s libgame.a shows
0000000a T initmodel
U lib3ds_file_free
U lib3ds_file_load
U lib3ds_file_material_by_name