正在链接提升内存映射文件

Linking boost memory mapped files

本文关键字:内存 映射 文件 链接      更新时间:2023-10-16

我有一个在linux Debian上启动的程序,所以在那里链接很容易。我所要做的就是命令行:

LIBS += -lboost_system -lboost_iostreams

现在我必须在Windows上编译相同的程序。我下载了boost版本1.58,然后执行了bootstrapbjam。这编译了boost并创建了包含所有库的stage文件夹。

现在我正在使用内存映射文件类boost::iostreams::mapped_file_source(),所以我得到了多个链接错误,我举了一个例子:

FileCheck.obj:-1: error: LNK2019: unresolved external symbol "public: char const * __cdecl boost::iostreams::mapped_file_source::data(void)const " (?data@mapped_file_source@iostreams@boost@@QEBAPEBDXZ) referenced in function "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl MD5FromFile(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?MD5FromFile@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV12@@Z)

我试着链接以促进这一点。所以我添加了boost的路径和:

LIBS += -L"X:/Path/to/boost/boost_1_58_0/stage/lib"
LIBS += -llibboost_system-vc120-mt-1_58    -llibboost_iostreams-vc120-mt-1_58
LIBS += -llibboost_system-vc120-mt-gd-1_58 -llibboost_iostreams-vc120-mt-gd-1_58

但我还是犯了这个错误。现在我想指出,编译器(VS2013(找到了lib文件,但这显然还不够。

我还想提到,我也使用Boost::ASIO和OpenSSL,但这些链接没有问题。

知道如何链接到增强内存映射文件吗

谢谢。

是否确定32或64位库版本?如果您在32中构建,并且库在64中,则可能会出现。