简体   繁体   English

在64位程序VS2015中链接升压

[英]linking boost in 64-bit program VS2015

I am in the process of upgrading a big boost-intensive program to VS2015, and boost 1.61. 我正在将一个大型的Boost密集型程序升级到VS2015,并提升1.61。 The program is a 64-bit program - x64 该程序是64位程序-x64

Boost seems to look for the wrong libraries in 64-bit mode (Or more likely I did something stupid). Boost似乎在64位模式下寻找错误的库(或更可能是我做了一些愚蠢的事情)。 I believe I have built the correct boost libraries for the VS2015 platform. 我相信我已经为VS2015平台构建了正确的Boost库。

I tried from scratch making a tiny boost function in WIN32 mode, that requires static linking. 我从头开始尝试在WIN32模式下制作一个微小的boost函数,该函数需要静态链接。 This works fine...... 效果很好......

#include <boost/regex.hpp>
#include <iostream>
#include <string>

void test()
{
 std::string line;
 boost::regex pat("^Subject: (Re: |Aw: )*(.*)");
  while (std::cin)
  {
    std::getline(std::cin, line);
    boost::smatch matches;
    if (boost::regex_match(line, matches, pat))
        std::cout << matches[2] << std::endl;
  }
}

But when I want to compile this in x64 boost complains. 但是,当我想在x64 boost中进行编译时会抱怨。 Yes I have set the #include and link path correctly for both platforms. 是的,我已经为两个平台正确设置了#include和链接路径。 The libraries are not there. 库不在那里。

1>LINK : fatal error LNK1104: cannot open file 'libboost_regex-vc140-mt-gd-1_61.lib' 1> LINK:致命错误LNK1104:无法打开文件'libboost_regex-vc140-mt-gd-1_61.lib'

libboost_regex-vc140-mt-1_61.lib libboost_regex-vc140-mt-1_61.lib

  1. Check if you've built boost at 64 bit 检查您是否在64位上构建了Boost
  2. Check if you've added boost library folder to che Visual studio project (Properties->Linker->General->Additional Library Folder) 检查是否已将boost库文件夹添加到che Visual Studio项目中(属性->链接器->常规->其他库文件夹)
  3. Check if you're building your solution at 64 bit 检查您是否在64位上构建解决方案
  4. If you're not using auto linking, chech if you've added the library dependency in project (Properties->Linker->Input->Additional Dependencies) 如果未使用自动链接,请检查是否已在项目中添加了库依赖项(属性->链接器->输入->其他依赖项)

You need to build the correct set of libraries the compiler is asking for. 您需要构建编译器要求的正确库集。 You should consult the library naming chart to get the build arguments (ie properties) to use while building. 您应该查阅库命名表以获取在构建时要使用的构建参数(即属性)。 In your case it's looking for libraries tagged as "lib--mt-gd-1_61.lib". 在您的情况下,它正在寻找标记为“ lib--mt-gd-1_61.lib”的库。 Which reading the chart says you would need to build with: 哪个读图说您需要构建:

link=static threading=multi runtime-debugging=on variant=debug

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

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