Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » GCC Linker(-lrt is not included into options)
GCC Linker [message #1778736] Wed, 20 December 2017 15:29 Go to next message
Ralph Feuchter is currently offline Ralph FeuchterFriend
Messages: 6
Registered: December 2017
Junior Member
Hello,
I use Luna Service Release 2 (4.4.2) with arm-linux-raspberry tool chain on windows.
I need to include librt.so. To do so I added rt in Cross G++Linker, Libraries, upper window (-l). In the lower window I put the path where the lib is stored. Now I would expect to found those enties in the main view from Cross G++ Linker. but there is no -lrt. However -L<path> exicits.
If I compile I get nothing underlined from exlipse but the linker complains. and indeed in the make file there is no -lrt neither.
can somebody tell me what shall I do to get the -lrt option into the linker path?
By the way on my ubuntu system it works fine, but not on Windows.
Thanks in advance

Ralph
Re: GCC Linker [message #1778893 is a reply to message #1778736] Sat, 23 December 2017 06:26 Go to previous messageGo to next message
David Vavra is currently offline David VavraFriend
Messages: 644
Registered: October 2012
Senior Member
Works in Oxygen and don't see why it wouldn't work in Luna as there should be no fundamental difference.
Make sure that you changed the current configuration (selected at the top of the dialog)
and also clean the project to force a new makefile to be generated.
You may need to delete the configuration directory to get a new makefile.

UPDATE: Tried it with NEON.3 in Windows linking a MinGW library and it worked.
g++ "-LC:\\Apps\\MinGW\\lib" -o Hello.exe Hello.o -lkernel32

[Updated on: Sat, 23 December 2017 06:37]

Report message to a moderator

Re: GCC Linker [message #1778974 is a reply to message #1778893] Wed, 27 December 2017 10:07 Go to previous messageGo to next message
Ralph Feuchter is currently offline Ralph FeuchterFriend
Messages: 6
Registered: December 2017
Junior Member
Hello,
thanks for reply. On my linux system I have oxygen and there it works. On the windows system (luna), I even re-created a new project, .. same result.
The surprising thing is, putting -L {PATH} as option, it appears as Linker option
however putting rt in the libaries (-l) box above, -lrt doesn't appear in the make file.
I attached the makefile -Linker content, log and Screenshot.
there must be something wrong on my side. Before I try to upgrade I want to make sure that I did all in the right way.
May I ask you to have a look into the attached files. Maybe there is a option which I need to enable to consider (-l) options .. ??

Thank you very much

Ralph
Re: GCC Linker [message #1778993 is a reply to message #1778974] Thu, 28 December 2017 00:45 Go to previous messageGo to next message
David Vavra is currently offline David VavraFriend
Messages: 644
Registered: October 2012
Senior Member
The link settings are for configuration Debug
but the building log is for configuration Release

You may have changed the wrong configuration.
I suspect this is something you want in all configurations though.
Select [ All configurations ] if you do.
Re: GCC Linker [message #1779183 is a reply to message #1778993] Wed, 03 January 2018 16:29 Go to previous messageGo to next message
Ralph Feuchter is currently offline Ralph FeuchterFriend
Messages: 6
Registered: December 2017
Junior Member
Thanks for replying and happy new year ..
- clicking right on the project, Build Configuration, Set Activ, Debug is flagged
- in Properties, C/C11 Build view I selected now [All configurations]
but I still get the message that Library functions out of rtlib are not found because of not including -lrt
the funny thing is however there is a binary file produced under Debug despite of the error.
make all
'Building target: raspi_timer_1'
'Invoking: Cross G++ Linker'
arm-linux-gnueabihf-g++ -o "raspi_timer_1" ./src/main.o
./src/main.o: In function `start_timer(void**, int, int)':
main.cpp:(.text+0xa8): undefined reference to `timer_create'
main.cpp:(.text+0xbc): undefined reference to `timer_settime'
./src/main.o: In function `stop_timer(void**)':
main.cpp:(.text+0x108): undefined reference to `timer_settime'
collect2.exe: error: ld returned 1 exit status
make: *** [raspi_timer_1] Error 1


How can I make sure that the entry under Properties/ C/C++ Build/Settings/Cross G++ Linker Option -l (upper part of the view) appears in the gray Option field on the Linkers main view (All option:)

It seems to enable -l option need a switch to be recognized in the Linker option and then being included in make file
I tried to follow your advice, may be I missed something .
I attached the new log
Thx
Ralph

Re: GCC Linker [message #1779184 is a reply to message #1778993] Wed, 03 January 2018 16:29 Go to previous messageGo to next message
Ralph Feuchter is currently offline Ralph FeuchterFriend
Messages: 6
Registered: December 2017
Junior Member
Thanks for replying and happy new year ..
- clicking right on the project, Build Configuration, Set Activ, Debug is flagged
- in Properties, C/C11 Build view I selected now [All configurations]
but I still get the message that Library functions out of rtlib are not found because of not including -lrt
the funny thing is however there is a binary file produced under Debug despite of the error.
make all
'Building target: raspi_timer_1'
'Invoking: Cross G++ Linker'
arm-linux-gnueabihf-g++ -o "raspi_timer_1" ./src/main.o
./src/main.o: In function `start_timer(void**, int, int)':
main.cpp:(.text+0xa8): undefined reference to `timer_create'
main.cpp:(.text+0xbc): undefined reference to `timer_settime'
./src/main.o: In function `stop_timer(void**)':
main.cpp:(.text+0x108): undefined reference to `timer_settime'
collect2.exe: error: ld returned 1 exit status
make: *** [raspi_timer_1] Error 1


How can I make sure that the entry under Properties/ C/C++ Build/Settings/Cross G++ Linker Option -l (upper part of the view) appears in the gray Option field on the Linkers main view (All option:)

It seems to enable -l option need a switch to be recognized in the Linker option and then being included in make file
I tried to follow your advice, may be I missed something .
I attached the new log
Thx
Ralph

Re: GCC Linker [message #1779185 is a reply to message #1778993] Wed, 03 January 2018 16:29 Go to previous messageGo to next message
Ralph Feuchter is currently offline Ralph FeuchterFriend
Messages: 6
Registered: December 2017
Junior Member
Thanks for replying and happy new year ..
- clicking right on the project, Build Configuration, Set Activ, Debug is flagged
- in Properties, C/C11 Build view I selected now [All configurations]
but I still get the message that Library functions out of rtlib are not found because of not including -lrt
the funny thing is however there is a binary file produced under Debug despite of the error.
make all
'Building target: raspi_timer_1'
'Invoking: Cross G++ Linker'
arm-linux-gnueabihf-g++ -o "raspi_timer_1" ./src/main.o
./src/main.o: In function `start_timer(void**, int, int)':
main.cpp:(.text+0xa8): undefined reference to `timer_create'
main.cpp:(.text+0xbc): undefined reference to `timer_settime'
./src/main.o: In function `stop_timer(void**)':
main.cpp:(.text+0x108): undefined reference to `timer_settime'
collect2.exe: error: ld returned 1 exit status
make: *** [raspi_timer_1] Error 1


How can I make sure that the entry under Properties/ C/C++ Build/Settings/Cross G++ Linker Option -l (upper part of the view) appears in the gray Option field on the Linkers main view (All option:)

It seems to enable -l option need a switch to be recognized in the Linker option and then being included in make file
I tried to follow your advice, may be I missed something .
I attached the new log
Thx
Ralph

Re: GCC Linker [message #1779186 is a reply to message #1778993] Wed, 03 January 2018 16:29 Go to previous messageGo to next message
Ralph Feuchter is currently offline Ralph FeuchterFriend
Messages: 6
Registered: December 2017
Junior Member
Thanks for replying and happy new year ..
- clicking right on the project, Build Configuration, Set Activ, Debug is flagged
- in Properties, C/C11 Build view I selected now [All configurations]
but I still get the message that Library functions out of rtlib are not found because of not including -lrt
the funny thing is however there is a binary file produced under Debug despite of the error.
make all
'Building target: raspi_timer_1'
'Invoking: Cross G++ Linker'
arm-linux-gnueabihf-g++ -o "raspi_timer_1" ./src/main.o
./src/main.o: In function `start_timer(void**, int, int)':
main.cpp:(.text+0xa8): undefined reference to `timer_create'
main.cpp:(.text+0xbc): undefined reference to `timer_settime'
./src/main.o: In function `stop_timer(void**)':
main.cpp:(.text+0x108): undefined reference to `timer_settime'
collect2.exe: error: ld returned 1 exit status
make: *** [raspi_timer_1] Error 1


How can I make sure that the entry under Properties/ C/C++ Build/Settings/Cross G++ Linker Option -l (upper part of the view) appears in the gray Option field on the Linkers main view (All option:)

It seems to enable -l option need a switch to be recognized in the Linker option and then being included in make file
I tried to follow your advice, may be I missed something .
I attached the new log
Thx
Ralph

Re: GCC Linker [message #1779435 is a reply to message #1779186] Mon, 08 January 2018 00:27 Go to previous message
David Vavra is currently offline David VavraFriend
Messages: 644
Registered: October 2012
Senior Member
The settings dialog allows you to specify which build configuration makefile you want to change.
Selecting All configurations means that the changes you subsequently make will apply to all configurations.
The keyword is subsequently.

You build by selecting a configuration to build from Project --> Build Configurations --> Set Active.

Your previous post showed you changed the configuration named Debug but built from the one named Release.
Your latest post is not showing which configuration is being built.
You omitted the line beginning **** Build of configuration


Previous Topic:Can Eclipse CDT give hierarchy info?
Next Topic:Color settings broken after switching to dark theme and back - Eclipse Oxygen.2 and CDT 9.4
Goto Forum:
  


Current Time: Sun Jan 21 03:01:03 GMT 2018

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

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