简体   繁体   中英

Eclipse cannot find library

I have a problem with adding library to my c project in eclipse. I have libraries *.lib which I have to add to my project. I've added them in "paths and symbols-> libraries" (only names of the libraries) and the path to the libraries directory in "paths and symbols-> library path)

I do everything as it is in the user guide but linker shows that he cannot find this libraries. Any ideas?

In short:

Edit library from full path to library name like:

<path>/lib<name>.so to <name>

This will lead to linking with flag -l<name> which is right.


I got the same issue as you by following to your steps. I used ACE library for testing.

  • I added ACE library to Project/Properties/C/C++ General/Paths and Symbols/Libraries

  • I added path to libraries to Project/Properties/C/C++ General/Paths and Symbols/Library Paths

After that, in Project/Properties/C/C++ Build/Settings/Libraries I've got:

  • /usr/local/lib/libACE.so as library.
  • /usr/local/lib as library path.

That lead to linking with flag -l/usr/local/lib/libACE.so which isn't right. As I know, there shouldn't be lib prefix when using -l flag.

When I changed /usr/local/lib/libACE.so to ACE in Project/Properties/C/C++ Build/Settings/Libraries , linking went normally.


This is the test code I compiled:

#include <ace/Time_Value.h>

int main() {

    ACE_Time_Value t;
    t.msec(1000);

}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM