Skip to main content



      Home
Home » Language IDEs » C / C++ IDE (CDT) » Link my own library
Link my own library [message #1758369] Tue, 28 March 2017 03:40 Go to next message
Eclipse UserFriend
Hello,

Firstly i am sorry for my aproximate english.

I ask your help because i have a problem with my project.

I would like to link my own library in my project. This library is static and i have already generated the file .a with the same software environnement.

Just for info, I work whith Simplicty studio which included Eclipse like IDE.
My compilator is a GNU 9.4.3

I configured the settings to include my librairy with the good acces

Invoking: GNU ARM C Linker
arm-none-eabi-gcc -g -gdwarf-2 -mcpu=cortex-m3 -mthumb -T "APP_LightClicKW.ld" -L"C:\Users\user\SimplicityStudio\v4_workspace\APP_LightClicKW\Library" -LC:/RTX/reptile/RTX/LIB/GCC/ -Xlinker --gc-sections -Xlinker -Map="APP_LightClicKW.map" --specs=nano.specs -o APP_LightClicKW.axf -Wl,--start-group -lRTX_CM3 -lModuleIP -Wl,--end-group -Wl,--start-group -lgcc -lc -lnosys -Wl,--end-group



The consol of compilator return this problem:
undefined reference (about some functions of my library)

It's stange, i have my declaration in the library and the defined is in one of my files'project.

Have i miss something with gcc compilator?
Re: Link my own library [message #1758447 is a reply to message #1758369] Tue, 28 March 2017 14:31 Go to previous message
Eclipse UserFriend
Some things to know about GCC linking:

General options: https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html#Link-Options
Options summary: https://gcc.gnu.org/onlinedocs/gcc/Option-Summary.html
Unfortunately, there are a number of options not specified in all GNU documents.
Some more options: ftp://ftp.gnu.org/old-gnu/Manuals/ld-2.9.1/html_node/ld_3.html
The manual for ld: ftp://ftp.gnu.org/old-gnu/Manuals/ld-2.9.1/html_mono/ld.html

The -L (capital L) adds a directory to the library search path.
-L<directory containing library>

-l<name> (small L) specifies a library.
In general, it is only used if the library name follows the convention lib<name>.a
See the discussion in the links.
So, -Llibdir -lxxx is equivalent to libdir/libxxx.a
You can specify a library by placing it in the command line with an explicit name.
libdir/nonconforminglibname.a

Also, libraries need to be specified AFTER references to the contained functions.
The files within --start-group ... --end-group , synonyms for '-(' and '-)', will be searched repeatedly

HTH

[Updated on: Thu, 30 March 2017 05:29] by Moderator

Previous Topic:Building cdt plugin from source
Next Topic:No device available (STM32F4xx is selected but not shown ) : properties > Setting > C build
Goto Forum:
  


Current Time: Wed May 14 13:21:33 EDT 2025

Powered by FUDForum. Page generated in 0.03364 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top