|
Re: linking to shared libraries (-o) in Eclipse Oxygen C/C++ IDE [message #1785506 is a reply to message #1785499] |
Mon, 16 April 2018 02:53 |
David Vavra Messages: 1426 Registered: October 2012 |
Senior Member |
|
|
According to the loader documentation, -lxxx (small L) looks for libxxx.so then libxxx.a
ftp://ftp.gnu.org/old-gnu/Manuals/ld-2.9.1/html_node/ld_3.html
Note that the format for a library name is libxxx.so or libxxx.a
To make this work with versioned names, a symlink is used
$ ls -l /usr/lib64 | grep FLAC
lrwxrwxrwx. 1 root root 16 Feb 3 2016 libFLAC.so -> libFLAC.so.8.3.0
lrwxrwxrwx. 1 root root 18 Feb 3 2016 libFLAC++.so -> libFLAC++.so.6.3.0
-rwxr-xr-x. 1 root root 104K Feb 3 2016 libFLAC++.so.6.3.0
-rwxr-xr-x. 1 root root 362K Feb 3 2016 libFLAC.so.8.3.0
If your library doesn't follow this naming convention
then you can include it where an object file would appear using no flags.
You'll likely also need to use the full path (relative can be used but it's tricky).
In Eclipse this would be in
Project --> Properties --> C/C++ Build --> Settings --> Tool Settings tab --> GCC C++ Linker --> Miscellaneous --> Other objects
[Updated on: Mon, 16 April 2018 03:35] Report message to a moderator
|
|
|
|
Re: linking to shared libraries (-o) in Eclipse Oxygen C/C++ IDE [message #1785571 is a reply to message #1785554] |
Mon, 16 April 2018 23:41 |
David Vavra Messages: 1426 Registered: October 2012 |
Senior Member |
|
|
Not sure what you expect Eclipse to be doing for you.
The extent of Eclipse's involvement is to take the information you provide and pass it to the loader.
Then execute the loader using make and display the resulting output.
Beyond getting the linker command line correct, I doubt your issue is with Eclipse.
"Didn't work" is a bit vague.
Perhaps you can post the build log that shows the problem.
You might have given Eclipse/CDT incorrect parameters for the linker.
If so, we might be able to help you.
But do be aware, your issue is most likely with the GNU loader.
Discussing the fine points of using external tools is beyond the scope of this forum.
Getting Eclipse to set up the command line is within scope though.
Understanding how to use the external tools outside of Eclipse will go a long way toward knowing what Eclipse expects.
[Updated on: Tue, 17 April 2018 00:48] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.03776 seconds