简体   繁体   中英

C++ Boost Link error

I am working on Windows 10 and I downloaded Boost 1.60 for Visual Studio 2015.

My first code snippet looks as:

#include <boost/thread.hpp>
#include <vector>
#include <iostream>
#include <sstream>
#include <cmath>
#include <iostream>

using namespace std;
void main()
{
    std::cout << "Hello World";

}

I get the error:

>LINK : fatal error LNK1104: cannot open file 'libboost_thread-vc140-mt-gd-1_60.lib'

I have provided path for boost and also libraries as shown in pics:

在此处输入图片说明

在此处输入图片说明

You need to compile the library before using it. Here's how to compile it:

In your Windows Start menu open the "Developer Command Prompt for VS2015". Then inside the opened command prompt, execute those commands:

cd C:\\boost_1_60_0

bootstrap.bat

.\\b2 runtime-link=shared toolset=msvc-14.0

Wait for a couple of minutes, since compilation takes a while.

Specify in your project in Linker -> General , the Additional Library Directories path as C:\\boost_1_60_0\\stage\\lib , and in C++ -> General the Additional Include Directories path as C:\\boost_1_60_0

You should now be able to compile your code without problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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