Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » [SOLVED] Eclipse CDT Cannot find library (third party libraries)(Including libraries that do not follow linker naming scheme.)
[SOLVED] Eclipse CDT Cannot find library (third party libraries) [message #1778947] Tue, 26 December 2017 06:29 Go to next message
Michael Varghese Thomas is currently offline Michael Varghese ThomasFriend
Messages: 3
Registered: December 2017
Junior Member
I realise that this question has been asked a million times, but I have gone through those solutions and they have not helped me solve the issue.
I am trying to import a library called PDNALib.lib and a few header files. So I created a folder in the project director called "Include" and added the requisite files. I have attached the images below.

index.php/fa/31652/0/

index.php/fa/31653/0/


The compiler still isn't able to find the library. Is there something I am doing wrong? Should I follow some other step?

index.php/fa/31654/0/

[Updated on: Tue, 26 December 2017 09:48]

Report message to a moderator

Re: Eclipse CDT Cannot find library [message #1778948 is a reply to message #1778947] Tue, 26 December 2017 08:06 Go to previous messageGo to next message
David Vavra is currently offline David VavraFriend
Messages: 644
Registered: October 2012
Senior Member
This is a common misconception.
It's not Eclipse CDT that can't find the library -- it's GCC
The compilers and linker are parts of GCC which is external to Eclipse.

You need to understand what the compiler and linker options actually mean to GCC.
They are merely passed by Eclipse through the makefile.
Here is a summary of GCC options: https://gcc.gnu.org/onlinedocs/gcc-7.2.0/gcc/Option-Summary.html#Option-Summary

-I is a Directory Option: https://gcc.gnu.org/onlinedocs/gcc-7.2.0/gcc/Directory-Options.html#Directory-Options
which tells the compiler preprocessor how to find #include files.

-include file tells the compiler to always include file for every compilation.
Something that is rare.
https://gcc.gnu.org/onlinedocs/gcc-7.2.0/gcc/Preprocessor-Options.html#Preprocessor-Options

The limker options (https://gcc.gnu.org/onlinedocs/gcc-7.2.0/gcc/Link-Options.html#Link-Options)
-Ldirectory appends directory to the library search path
-lxxx is shorthand which tells the linker to search library libxxx.a
Some versions of GCC will also search for libxxx.so and libxxx.lib
If your library doesn't follow the naming convention used by -l then add the library as an Other Object found in the Miscellaneous linker settings.

Re: Eclipse CDT Cannot find library [message #1778951 is a reply to message #1778948] Tue, 26 December 2017 09:45 Go to previous message
Michael Varghese Thomas is currently offline Michael Varghese ThomasFriend
Messages: 3
Registered: December 2017
Junior Member
Hey!! That worked!! I kept seeing solutions to the same problem asking people to remove the 'lib' prefix of the library file names and was getting frustrated that it wouldn't apply in my case. I did not know about this technicality or the ability to add other objects. Thank you so much!! That's one new I learned today.
Previous Topic:Source codes that compile with command line but not in eclipse
Next Topic:Open Call Hierarchy fails on class functions
Goto Forum:
  


Current Time: Mon Jan 22 12:45:34 GMT 2018

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

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