MSVS 2012 Express - Boost - 链接器错误LNK2019

Cob*_*urn 2 c++ boost static-linking visual-studio-2012

我正在尝试构建一个使用Boost库的文件系统部分功能的项目,并且我不断收到链接器错误.
我按照Boost文档构建它并成功构建,然后将所有lib文件从stage目录移动到C:/ boost/lib,将hpp文件移动到C:/ boost/include.我正在使用Microsoft Visual Studio 2012 Express Edition.我已经确保将属性页面中的文件(libboost_filesystem-vc110-mt-1_54.lib和libboost_system-vc110-mt-1_54.lib)添加到需要链接的文件中(我也尝试过#pragma明确地说).我尝试了包含gd的.lib文件和那些不调试的文件(调试文件和不用于调试的文件).

我的问题是,我该如何解决这个问题?我构建错误的文件了吗?我是否指定了某种链接器属性错误?

这是错误(我省略了一些以保持简短,如果需要我可以将它们全部添加):

Error   1   error LNK2019: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::system_category(void)" (?system_category@system@boost@@YAAEBVerror_category@12@XZ) referenced in function "void __cdecl boost::system::`dynamic initializer for 'native_ecat''(void)" (??__Enative_ecat@system@boost@@YAXXZ)  C:\Visual Studio 2012 Projects\MMS_Solution\MMS_Prj_FindFile\MMS_Prj_FindFile.obj   MMS_Prj_FindFile
Error   2   error LNK2019: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::generic_category(void)" (?generic_category@system@boost@@YAAEBVerror_category@12@XZ) referenced in function "void __cdecl boost::system::`dynamic initializer for 'errno_ecat''(void)" (??__Eerrno_ecat@system@boost@@YAXXZ)  C:\Visual Studio 2012 Projects\MMS_Solution\MMS_Prj_FindFile\MMS_Prj_FindFile.obj   MMS_Prj_FindFile
[...]
Error   5   error LNK2019: unresolved external symbol "public: class boost::filesystem::path __cdecl boost::filesystem::path::root_path(void)const " (?root_path@path@filesystem@boost@@QEBA?AV123@XZ) referenced in function main  C:\Visual Studio 2012 Projects\MMS_Solution\MMS_Prj_FindFile\MMS_Prj_FindFile.obj   MMS_Prj_FindFile
Error   6   error LNK2019: unresolved external symbol "public: class boost::filesystem::path __cdecl boost::filesystem::path::root_name(void)const " (?root_name@path@filesystem@boost@@QEBA?AV123@XZ) referenced in function main  C:\Visual Studio 2012 Projects\MMS_Solution\MMS_Prj_FindFile\MMS_Prj_FindFile.obj   MMS_Prj_FindFile
[...]
Error   18  error LNK1120: 17 unresolved externals  C:\Visual Studio 2012 Projects\MMS_Solution\x64\Debug\MMS_Prj_FindFile.exe  MMS_Prj_FindFile
Run Code Online (Sandbox Code Playgroud)

这是链接器选项(如果需要其他选项,我可以添加它们):

链接器 - >常规
启用增量链接=是(/ INCREMENTAL)
忽略导入LIbrary =无
注册输出=无
每用户重定向=无
其他库目录= C:\ openssl\lib; C:\ boost\lib
链接库依赖关系=是
使用库依赖项输入=否
防止Dll绑定=

链接器 - >输入
所有这些都是空白的,除了
附加依赖项= ssleay32.lib; libeay32.lib; Ws2_32.lib; libboost_system-vc110-mt-1_54.lib; libboost_filesystem-vc110- MT-1_54.lib;%(AdditionalDependencies)

这是代码:

//Boost Includes
#include <boost/filesystem.hpp>

//Boost linking because visual studio won't link it (ugh)
#pragma comment (lib, "libboost_system-vc110-mt-gd-1_54.lib")
#pragma comment (lib, "libboost_filesystem-vc110-mt-gd-1_54.lib")

//Normal Includes
#include <iostream>
#include <string>

namespace bfs = boost::filesystem;

int main(int argc, char* argv[])
{
std::vector<std::string> foundPaths;
bfs::directory_iterator eit;
for(bfs::directory_iterator it("."); it != eit; it++)
{
    if(!bfs::is_regular_file(it->status()))
        continue;

    bfs::path foundPath = it->path();
    foundPaths.push_back("Root name: " + foundPath.root_name().string() + "\n" +
                         "Root dir : " + foundPath.root_directory().string() + "\n" + 
                         "Root path: " + foundPath.root_path().string() + "\n" +
                         "Rel  path: " + foundPath.relative_path().string() + "\n" +
                         "Prnt path: " + foundPath.parent_path().string() + "\n" +
                         "File name: " + foundPath.filename().string() + "\n" +
                         "Stem     : " + foundPath.stem().string() + "\n" +
                         "Extension: " + foundPath.extension().string() + "\n");
}

    for(std::vector<std::string>::iterator it = foundPaths.begin(); it !=     foundPaths.end(); ++it)
    {
        std::cout << *it << std::endl;
    }
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

Cob*_*urn 6

构建Boost时,如果要构建64位,请确保使用参数"address-model = 64".
它在文档中说你的编译器应该选择正确的,如果配置正确,但显然我的不是,并且当我想要64位二进制时正在构建32位二进制文​​件.