在 Code::blocks 中使用 Boost 时出现问题
我正在尝试使用 Boost 库配置 Code::Blocks(在 Windows 上运行,使用 MinGW)。我已经构建了库并将所有内容安装到 C:\Program Files\boost_1_47_0。
在 Code::Blocks 本身中,我创建了一个全局变量,它使用两个内置字段“base”和“include”,它们都指向 boost 安装路径。
我还修改了构建选项下的链接器设置并添加了链接库“$(#boost.lib)”。为了测试 boost,我已将 #include 放入我的项目中,但根本没有实际使用 include。但是,该项目没有构建(当然,它在放入 #include 之前构建了),并且我收到了源自“ld.exe”的构建错误,其中显示“找不到 -l-lstdc++”。有谁知道我做错了什么?
干杯。
I'm trying to configure Code::Blocks (running on Windows, using MinGW) with the Boost library. I have built the library and have installed everything to C:\Program Files\boost_1_47_0.
Within Code::Blocks itself, I have created a global variable, which uses two builtin fields, 'base' and 'include' which both point to the boost installation path.
I have also modified the linker settings under build options and added a link library '$(#boost.lib)'. To test boost, I have put #include within my project, without actually using the include at all. However, the project doesn't build (it did of course build prior to putting the #include in) and I get a build error originating from "ld.exe" which says "cannot find -l-lstdc++". Does anyone know what I'm doing wrong?
Cheers.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您收到的错误表明找不到
-l-lstdc++
;链接库设置有错误。如果您尝试在命令行上编译一个简单的 C++(非 Boost)应用程序并键入:
您将得到与 Code::Blocks 中看到的相同的错误:
这是因为您的库名称被指定为 < code>-lstdc++,而它应该只是
stdc++
而没有-l
。 (-l
是一个标志,告诉编译器下一个单词是库的名称。)检查链接库设置是否有额外的
-l
,或尝试将$(#boost.lib)
替换为 Boost 库的实际路径。The error that you're getting says it can't find
-l-lstdc++
; there is an error with the link library settings.If you try to compile a simple C++ (non-Boost) application on the command line and type:
You'll get the same error as what you see in Code::Blocks:
This is because you're library name is specified as
-lstdc++
when it should just bestdc++
with out the-l
. (The-l
is a flag to tell the compiler that the next word is the name of a library.)Check your link library settings for an extra
-l
, or try replacing$(#boost.lib)
with the actual path to the Boost library.