error: C1083: Cannot open include file: 'boost/asio.hpp': No such file or directory

Viewed 3494

I use Qt creator in windows 7. When I use 32-bit VC 2010 complier to complie my project, error occurs: error: C1083: Cannot open include file: 'boost/asio.hpp': No such file or directory

.pro:

LIBS += -L"D:/MDT/boost_1_71_0/libs" - 
   llibboost_date_time-vc141-mt-x32-1_71 \
    - 
    L"D:/MDT/boost_1_71_0/libs" - 
    llibboost_regex-vc141-mt-x32-1_71 \

main.cpp

   #include <boost/asio.hpp>
2 Answers

You will need to tell the compiler where to look for the include files.

Add

INCLUDEPATH += <path_to_boost_dir>

to the .pro file. In your case it will probably be

INCLUDEPATH += D:/MDT/boost_1_71_0/

You need to use INCLUDEPATH to specify where the libraries headers are, so you need to add: INCLUDEPATH += D:/MDT/boost_1_71_0/ in your .pro file and run qmake.

But the msvc141 (in boost lib names) stands for Visual Studio 2017 and that is not binary compatible with Visual Studio 2010 that you are using, so you will most likely get linker errors or weird run-time crashes. To fix that you need to download boost built with Visual Studio 2010, look for msvc10 (32 or 64 bit depending on your needs) on the website where you downloaded boost and get that version.

Related