2012-07-29 97 views
0

我按照 http://tayefeh.wordpress.com/2009/07/06/creating-and-using-a-c-shared-library-with-eclipse-cdt-galileo-and-gnu-c-compiler-and-linker/ 的说明构建共享库。C++/Eclipse共享库:为什么g ++不能找到这个库?

我有步骤二,子弹16点,但我的努力来构建项目失败,出现以下错误:

 
**** 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 

任何人都可以提出建议,为什么编译失败?该目录确实存在,ls显示

 
[[email protected] Debug]$ ls /home/ken/workspace/testlib/Debug/ 
libtestlib.so TestClass.o 

如果有帮助,我正在运行的CentOS 6.3。

感谢, 肯

回答

1

您应该删除这个:

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

它使g++找那名库。