简体   繁体   English

无法使用STLport库构建Boost

[英]Unable to build Boost with STLport library

I'm building boost 1.48.0 with STLport 5.2.1 on Windows using MSVC 7.1 and here is the command line I run: 我正在使用MSVC 7.1在Windows上使用STLport 5.2.1构建boost 1.48.0,这是我运行的命令行:

b2 toolset=msvc link=shared threading=multi runtime-link=shared variant=debug stdlib=stlport --layout=tagged stage

My user-config.jam is setup like so: 我的user-config.jam设置如下:

using msvc : 7.1 ;
using stlport : 5.2.1 : C:/Code/third_party_source/STLport-5.2.1/stlport : C:/Code/third_party_source/STLport-5.2.1/lib ;

I get several linker errors relating to STLport. 我收到了几个与STLport相关的链接器错误。 One of them looks like this: 其中一个看起来像这样:

path.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall stlpd
_std::basic_string<wchar_t,class stlpd_std::char_traits<wchar_t>,class stlpd_std::allocator<wchar_t>
 >::basic_string<wchar_t,class stlpd_std::char_traits<wchar_t>,class stlpd_std::allocator<wchar_t> >
(class stlpd_std::basic_string<wchar_t,class stlpd_std::char_traits<wchar_t>,class stlpd_std::alloca
tor<wchar_t> > const &)" (__imp_??0?$basic_string@_WV?$char_traits@_W@stlpd_std@@V?$allocator@_W@2@@
stlpd_std@@QAE@ABV01@@Z)

Why can't I get Boost building with STLport? 为什么我不能使用STLport构建Boost?

With the help of a few people on the Boost mailing list, I was able to get boost building with STLport. 在Boost邮件列表上的一些人的帮助下,我能够通过STLport获得建设。 Below are some instructions I wrote up for anyone else that has run into this problem: 以下是我为其他遇到此问题的人写的一些说明:

First make sure you have compiled STLport for your respective compiler. 首先确保已为各自的编译器编译了STLport。 Then go to the tools/build/v2 directory and edit the file user-config.jam to the following: 然后转到tools / build / v2目录并将文件user-config.jam编辑为以下内容:

using msvc : 8.0 ;
using stlport : 5.2.1 : C:/Code/third_party_source/STLport-5.2.1/stlport : C:/Code/third_party_source/STLport-5.2.1/lib-vc8 ;

Above, make sure you use the appropriate version of MSVC and correct absolute path to STLport. 在上面,确保使用适当版本的MSVC并更正STLport的绝对路径。 In this example I'm using MSVC8, but change it to your version per the following table: 在此示例中,我使用的是MSVC8,但根据下表将其更改为您的版本:

Visual Studio .NET 2003        -- 7.1
Visual Studio 2005             -- 8.0
Visual Studio 2008             -- 9.0
Visual Studio 2010             -- 10.0
Visual Studio 11               -- 11.0

Similarly, for the using stlport line, make sure you specify the appropriate version of STLport. 同样,对于using stlport行,请确保指定适当的STLport版本。 Here I am using version 5.2.1. 这里我使用的是5.2.1版本。 The next parameter is the path to the stlport include directory (change accordingly) and the third and final parameter is the path to the STLport libraries that are COMPILED FOR THE SAME VERSION OF MSVC . 下一个参数是stlport包含目录的路径(相应地更改),第三个也是最后一个参数是STLport库的路径,这些库是为MSVC的相同版本编译的

Once the user config file is setup, now you can build boost by invoking the following commands. 设置用户配置文件后,现在可以通过调用以下命令来构建boost。

For DEBUG: 对于DEBUG:

b2 toolset=msvc link=shared threading=multi runtime-link=shared variant=debug stdlib=stlport define=_STLP_DEBUG --layout=tagged stage

For RELEASE: 对于RELEASE:

b2 toolset=msvc link=shared threading=multi runtime-link=shared variant=release stdlib=stlport --layout=tagged stage

The important change I was missing was the define=_STLP_DEBUG option during invocation of b2 . 我缺少的重要更改是在调用b2期间的define=_STLP_DEBUG选项。

Your using stlport line is missing a version specifier. using stlport行缺少版本说明符。 Change it to: 将其更改为:

using stlport : 5.2.1 : C:/Code/work/rdailey-t510/depot/dev/gfe-dev/server/external/stlport/WINNT5.0_OPT.OBJ/stlport : C:/Code/work/rdailey-t510/depot/dev/gfe-dev/server/external/stlport/WINNT5.0_OPT.OBJ/lib ;

Then, when you invoke bjam/b2, specify the feature with the version included, ie 然后,当您调用bjam / b2时,请指定包含版本的功能,即

stdlib=stlport-5.2.1

(Of course, for versions of STLPort other than 5.2.1, substitute the correct version numbers.) (当然,对于除5.2.1之外的STLPort版本,请替换正确的版本号。)

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

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