0
我已經安裝了VS 2010,已經安裝在我的系統中。 所以當我下載QT(我必須使用QT作爲那個項目需求),我使用this link並安裝它。 它能夠自動檢測Visual C++編譯器,並且工作正常。如何使用qt創建器和msvc使用boost regex
現在我從boost.org下載Boost庫,並使用從Visual Studio命令提示符運行以下命令安裝: -
> bootstrap.bat msvc
>
> c:\boost_1_54_0>b2 install --prefix=c:/boostinst toolset=msvc-10.0
> variant=debug ,release link=static threading=multi
後,我打開Qt Creator的和下面的代碼添加CPP文件
#include <boost/regex.hpp>
#include
#include
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;
}
}
並添加使用ADD庫的庫,並生成以下.pro文件。
TEMPLATE = app
CONFIG += console
CONFIG -= app_bundle
CONFIG -= qt
INCLUDEPATH += C:\boostinst\include\boost-1_54 #if i remove this line, then also the same error
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../boostinst/lib/ -llibboost_regex-vc100-mt-1_54
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../boostinst/lib/ -llibboost_regex-vc100-mt-1_54d
else:unix: LIBS += -L$$PWD/../../../boostinst/lib/ -llibboost_regex-vc100-mt-1_54
INCLUDEPATH += $$PWD/../../../boostinst/include
DEPENDPATH += $$PWD/../../../boostinst/include
當我嘗試打造,它引發以下錯誤
C:\用戶\ XXX \ newcp \ main.cpp中:24:錯誤:C1083:無法打開包含文件:「升壓/ regex.hpp':沒有這樣的文件或目錄
我是錯過了什麼或做錯了什麼?請任何人儘快回覆。
我已經嘗試運行使用lambda,這是拋出相同的錯誤代碼。 – Sayok88
我想知道你是否真的需要使用''#include
不工作的傢伙。它拋出一個編譯錯誤。 – Sayok88