简体   繁体   中英

C++/Eclipse Shared Library: Why can g++ not find this library?

I am following the instructions on http://tayefeh.wordpress.com/2009/07/06/creating-and-using-ac-shared-library-with-eclipse-cdt-galileo-and-gnu-c-compiler-and-linker/ to build a shared library.

I have got to Step II, bullet point 16 but my attempts to build the project fail with the following error:

**** Build of configuration Debug for project UseDLL ****

make all 
Building target: UseDLL
Invoking: GCC C++ Linker
g++ -L"/home/ken/workspace/testlib/Debug" -o"UseDLL"  ./src/UseDLL.o   -ltestlib -l/home/ken/workspace/testlib/Debug
/usr/bin/ld: cannot find -l/home/ken/workspace/testlib/Debug
collect2: ld returned 1 exit status
make: *** [UseDLL] Error 1

Can anyone advise why the build is failing? The directory does exist and ls shows

[ken@localhost Debug]$ ls /home/ken/workspace/testlib/Debug/
libtestlib.so  TestClass.o

If it helps, I am running CentOS 6.3.

Thanks, Ken

You should remove this:

-l/home/ken/workspace/testlib/Debug

It makes g++ look for a library of that name.

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