簡體   English   中英

使用CL 19增強正則表達式鏈接器錯誤

[英]Boost regex linker error with cl 19

我將cl 1.6(Visual Studio 2015)與Boost 1.61.0一起使用。 我從使用命令行bootstrap.\\b2入門文檔中構建了boost庫。 這使得舞台目錄帶有一些vc14前綴庫。

但是當我嘗試編譯入門正則表達式程序時

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

int main()
{
    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;
    }
}

使用以下命令行編譯器設置:

cl main.cpp -I %BOOST_ROOT% -L %BOOST_LIB_14% /EHsc

我收到此錯誤:

Link:: fatal error LNK1181: cannot open input file 'C:\local\boost_1_61_0\stage\lib.obj

我的嘗試有什么問題?

編輯 :我更改了命令行編譯為:

cl main.cpp /I %BOOST_ROOT% /link /LIBPATH:%BOOST_LIB_14% /EHsc

現在,我得到這個錯誤:

LINK: fatal error LNK1104: cannot open file 'libbosst_regex-vc140-mt-s-1_61.lib'

我找到了解決方案。

我已經使用bootstrap.\\b2命令構建了boost庫。 它僅構建mt (多線程)和gd (調試)庫。

對於靜態鏈接( s ),圖書館我試過.\\b2 runtime-link=static和BUIT 'libbosst_regex-vc140-MT-S-1_61.lib'文件,而現在一切都OK。

我發現了mt-gd和mt-s庫之間有什么區別

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM