C++ 添加符号时出错:命令行中缺少 DSO

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/25864797/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-28 11:27:24  来源:igfitidea点击:

error adding symbols: DSO missing from command line

c++qtogre

提问by user3877872

Trying to use Ogre in the Qt project. Ogre is build succesfully. Running the project it gives me three errors:

尝试在 Qt 项目中使用 Ogre。Ogre 构建成功。运行项目它给了我三个错误:

/usr/lib/x86_64-linux-gnu/libboost_system.so.1.54.0:-1: error: error adding symbols: DSO missing from command line
-1: error: main.o: undefined reference to symbol '_ZN5boost6system15system_categoryEv'

When I searched for the error it says to edit the makefile and adding: LIBS =-lpthread

当我搜索错误时,它说编辑 makefile 并添加:LIBS =-lpthread

but it is already there.

但它已经在那里了。

How to resolve this error?

如何解决此错误?

回答by Kamalpreet Grewal

You need to link boost library in your project.

您需要在项目中链接 boost 库。

Add LIBS += -lboost_systemin your project's pro file.

添加LIBS += -lboost_system项目的 pro 文件。

回答by Hridaynath

In my case: I am using code blocks IDE and having the same error. I resolve it as below:

就我而言:我正在使用代码块 IDE 并遇到相同的错误。我解决它如下:

  • In code blocks IDE goto settings > compiler.
  • Under the "Linker Settings" tab add path : /usr/lib/x86_64-linux-gnu/libboost_system.so
  • 在代码块中,IDE 转到设置 > 编译器。
  • 在“链接器设置”选项卡下添加路径:/usr/lib/x86_64-linux-gnu/libboost_system.so

Now build your program again.

现在再次构建您的程序。

Hope this will be usfull.

希望这将是有用的。