Problem using Boost in Code::blocks
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 开发者_Python百科'$(#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.
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:
g++ main.cpp -o main.o -l-lstdc++
You'll get the same error as what you see in 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
. (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.
精彩评论