致命错误 LNK1104:无法打开文件“libboost_system-vc110-mt-gd-1_51.lib"

2021-12-24 00:00:00 visual-studio c++ boost

似乎我无法让它发挥作用.我制作了一个简单的控制台应用程序(它依赖于 websocket++ 库),它需要 Boost 库......但是当我尝试编译时,我得到:

Seem I can't get this to work. I made a simple console application (which depend on websocket++ library) which need Boost libraries.. but when I try to compile I get:

致命错误 LNK1104:无法打开文件libboost_system-vc110-mt-gd-1_51.lib"

fatal error LNK1104: cannot open file 'libboost_system-vc110-mt-gd-1_51.lib'

但是,我做了在 (boost_root)/stage/libs 中创建 lib 的 bjam,并将 libs 的路径链接到编译器 C++/Additionnals 包括.

However, I did the bjam which created the lib in (boost_root)/stage/libs and I linked the path to the libs to the compiler C++/Additionnals includes.

如果我查看 (boost_root)/stage/libs 文件 libboost_system-vc110-mt-gd-1_51.lib 不存在.它被称为 libboost_system-vc110-mt-sgd-1_51.lib.

If I look in (boost_root)/stage/libs the file libboost_system-vc110-mt-gd-1_51.lib is not there. It is called libboost_system-vc110-mt-sgd-1_51.lib instead.

有什么想法吗?

推荐答案

C++ → General → Additional Include Directories 参数用于列出编译器将在其中搜索头文件的目录.

The C++ → General → Additional Include Directories parameter is for listing directories where the compiler will search for header files.

您需要告诉链接器在何处查找要链接的库.要访问此设置,请在解决方案资源管理器 窗口中右键单击项目名称,然后在属性 → 链接器 → 常规 → 其他库目录.在此处输入 stagelib(如果您构建,这是库所在的路径)使用默认选项提升).

You need to tell the linker where to look for libraries to link to. To access this setting, right-click on the project name in the Solution Explorer window, then Properties → Linker → General → Additional Library Directories. Enter <boost_path>stagelib here (this is the path where the libraries are located if you build Boost using default options).

相关文章