#2915 - col - Fri Feb 14, 2003 2:03 pm
Hi , I'm having some problems using a custom library in my link process.
I have built the library with:
arm-agb-elf-ar rcs myLib.a foo.o bar.o etc.
I have also tried:
arm-agb-elf-ar rc myLib.a foo.o bar.o etc.
arm-agb-elf-ranlib myLib.a
When I try to use it with devkitadv (windows):
-L pathToMyLib or -lmyLib.a
It dosn't work work.
I am including headers for the individual .o files that make up the library.
The headers are being accessed in the compile process, it's just linking that's messed up.
(I have a feeling that it might be a cygwin issue as when i use -lmyLib.a, gcc can never find it!)
any suggestions?
cheers
col
#2916 - Saikou - Fri Feb 14, 2003 2:18 pm
I'm not too sure if this is right, I don't have that much experience with gcc.
What I do is use ar to make the .a file, then pass it along to gcc along with the .o files, i.e. without the -L or -l option
Example:
gcc Main.o MyLib.a -o Game.elf
#2928 - col - Fri Feb 14, 2003 3:25 pm
Saikou wrote: |
I'm not too sure if this is right, I don't have that much experience with gcc.
What I do is use ar to make the .a file, then pass it along to gcc along with the .o files, i.e. without the -L or -l option
Example:
gcc Main.o MyLib.a -o Game.elf |
Thanks
I'll give that a try (when I get home)
[edit] yep, thanks that worked.
I'd still like to know why the -L -l switches don't work, and what they are specifically for - anyone know?
cheers
col
#2971 - BitWise - Sat Feb 15, 2003 10:24 am
The -L option specifies the directories to look in for libararies while the -l provides the name of the target (less the lib prefix and .a suffix parts).
So assuming that libmylib.a is in a directory ../lib relative to the current directory you need to:
gcc -L../lib example.o -lmylib -o myApp
#2972 - BitWise - Sat Feb 15, 2003 10:26 am
The -L option specifies the directories to look in for libararies while the -l provides the name of the target (less the lib prefix and .a suffix parts).
So assuming that libmylib.a is in a directory ../lib relative to the current directory you need to:
gcc -L../lib example.o -lmylib -o myApp
#2978 - col - Sat Feb 15, 2003 2:24 pm
BitWise wrote: |
The -L option specifies the directories to look in for libararies while the -l provides the name of the target (less the lib prefix and .a suffix parts).
So assuming that libmylib.a is in a directory ../lib relative to the current directory you need to:
gcc -L../lib example.o -lmylib -o myApp |
Thanks, I knew what -L and -l were supposed to mean, but i didn't realise that the name of the lib should always pe prefixed with 'lib' ie.
libmyLib.a instead of myLib.a
Am I understanding this correctly?
cheers
col.
Last edited by col on Sun Feb 16, 2003 2:16 am; edited 1 time in total