简体   繁体   English

在Code :: blocks中使用Boost问题

[英]Problem using Boost in Code::blocks

I'm trying to configure Code::Blocks (running on Windows, using MinGW) with the Boost library. 我正在尝试使用Boost库配置Code :: Blocks(在Windows上运行,使用MinGW)。 I have built the library and have installed everything to C:\\Program Files\\boost_1_47_0. 我已经建立了该库,并将所有内容都安装到了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. 在Code :: Blocks本身中,我创建了一个全局变量,该变量使用两个内置字段“ base”和“ include”,它们均指向boost安装路径。

I have also modified the linker settings under build options and added a link library '$(#boost.lib)'. 我还修改了构建选项下的链接器设置,并添加了链接库'$(#boost.lib)'。 To test boost, I have put #include within my project, without actually using the include at all. 为了测试提升,我将#include放入了我的项目,而实际上根本没有使用include。 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++". 但是,该项目无法构建(它当然是在将#include放入之前进行构建的),并且我收到源自“ ld.exe”的构建错误,该错误表示“找不到-l-lstdc ++”。 Does anyone know what I'm doing wrong? 有人知道我在做什么错吗?

Cheers. 干杯。

The error that you're getting says it can't find -l-lstdc++ ; 您得到的错误表明找不到-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: 如果您尝试在命令行上编译一个简单的C ++(非增强型)应用程序,然后键入:

g++ main.cpp -o main.o -l-lstdc++

You'll get the same error as what you see in Code::Blocks: 您将得到与在Code :: Blocks中看到的错误相同的错误:

/usr/bin/ld: cannot find -l-lstdc++

This is because you're library name is specified as -lstdc++ when it should just be stdc++ with out the -l . 这是因为您将库名指定为-lstdc++时,应将其命名为stdc++而没有-l (The -l is a flag to tell the compiler that the next word is the name of a library.) -l是告诉编译器下一个单词是库名称的标志。)

Check your link library settings for an extra -l , or try replacing $(#boost.lib) with the actual path to the Boost library. 检查链接库设置是否有额外的-l ,或尝试将$(#boost.lib)替换$(#boost.lib) Boost库的实际路径。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM