C++/Eclipse共享库:为什么g++找不到这个库

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

本文关键字:g++ 找不到 为什么 Eclipse 共享 C++      更新时间:2023-10-16

我正在按照http://tayefeh.wordpress.com/2009/07/06/creating-and-using-a-c-shared-library-with-eclipse-cdt-galileo-and-gnu-c-compiler-and-linker/建立一个共享库。

我已经到了第二步,第16点,但我构建项目的尝试失败了,出现了以下错误:

****生成配置项目UseDLL的调试****使全部正在生成目标:UseDLL调用:GCC C++链接器g++-L"/home/ken/workspace/testlib/Debug"-o"UseDLL"/src/UseDLL.o-ltestlib-l/home/ken/workspace/testlib/Debug/usr/bin/ld:找不到-l/home/ken/workspace/testlib/Debugcollect2:ld返回1退出状态make:***[UseDLL]错误1

有人能告诉我们构建失败的原因吗?目录确实存在,并且ls显示

[ken@localhost调试]$ls/home/ken/workspace/testlib/Debug/libtestlib.so测试类-o

如果有帮助的话,我运行的是CentOS 6.3。

谢谢,Ken

您应该删除以下内容:

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

它使g++查找具有该名称的库。