简体   繁体   English

安装Boost与CodeBlocks一起使用

[英]Installing Boost To Work With CodeBlocks

I am trying to install Boost so I can use it along with MinGW and Code Blocks. 我正在尝试安装Boost,以便可以将其与MinGW和代码块一起使用。 I'm running Code Blocks 10.05 and the version of MinGW that comes with the download on the Codeblocks website. 我正在运行Code Blocks 10.05,以及在Codeblocks网站上下载的MinGW版本。 I've downloaded Boost 1.49.0 from http://www.boost.org/ . 我已经从http://www.boost.org/下载了Boost 1.49.0。 I've seen several different guides for installing Boost(building from source that is). 我已经看到了几种安装Boost的不同指南(从源代码构建)。 However, none of them seem to play out nicely at all, with me getting stuck in the initial steps. 但是,它们似乎都无法很好地发挥作用,因为我陷入了最初的步骤。 I've attempted to run bootstrap.bat in the base directory /boost_1_49_0 and also in /boost_1_49_0/tools/build/v2. 我试图在基本目录/ boost_1_49_0和/ boost_1_49_0 / tools / build / v2中运行bootstrap.bat。

Both yield a popup that tells me I'm missing mspdb100.dll. 两者都会弹出一个窗口,告诉我我缺少mspdb100.dll。 Do I need to get this dll somehow? 我是否需要以某种方式获取此dll? Am I following the wrong procedure to install this? 我是否按照错误的步骤进行安装?

When this error occurs, bootstrap.bat doesn't build the error log that it says so that is essentially useless. 发生此错误时,bootstrap.bat不会构建其显示的错误日志,因此实际上是没有用的。 However, uninstalling Microsoft Visual C++ cause the dll error to disappear and the log file will generate. 但是,卸载Microsoft Visual C ++会导致dll错误消失,并且将生成日志文件。 It shows that it attempts use msvc to build the project instead of gcc. 它表明它尝试使用msvc而不是gcc来构建项目。 So unlike the direction given in several guides, you must specify the toolkit at this point: 因此,与一些指南中给出的指导不同,您必须在此时指定工具箱:

bootstrap.bat gcc

Then it will prompt you to run a file called b2 that can be built with the options (among others). 然后,它将提示您运行一个名为b2的文件,该文件可以使用选项(以及其他选项)构建。

b2 --build-dir=C:\exampledir toolset=gcc

It appears in order for boost to be used that you have to explicitly add the files in <builddir>\\boost\\bin.v1\\libs\\system . 为了使用boost,必须在<builddir>\\boost\\bin.v1\\libs\\system显式添加文件。 Otherwise the you get an error like: 否则,您将收到如下错误:

In function `_static_initialization_and_destruction_0':|
C:\removed\boost_1_49_0\boost\system\error_code.hpp|214|undefined reference to `boost::system::generic_category()'|
C:\removed\system\error_code.hpp|215|undefined reference to `boost::system::generic_category()'|
C:\removed\boost_1_49_0\boost\system\error_code.hpp|216|undefined reference to `boost::system::system_category()'|

The linker options can be found in Code Blocks by going to Project -> Build Options -> Linker Settings -> Add . 可以在“代码块”中找到链接器选项,方法是进入“ 项目”->“构建选项”->“链接器设置”->“添加” Adding these libraries explicitly seems to be necessary even if you add the build directory to the linker Search Directories. 即使将构建目录添加到链接器“搜索目录”中,似乎也有必要显式添加这些库。

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

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