简体   繁体   中英

Build Boost on Windows 10 VS2015 - Cannot Open *.lib

I'm not very C++ savvy yet and have been looking at creating a small project to get better used to the language and so on.

Since what I want to do involves lots of disk scanning and file things I decided to look at the Boost libraries, specifically the filesystem library.

I've been working though this guide:

http://www.boost.org/doc/libs/1_61_0/more/getting_started/windows.html

I'm using Microsoft tools including Visual Studio 2015 on Windows 10.

I downloaded boost in zip format and extracted to:

G:\C++\boost\boost_1_61_0

Then ran the described commands:

> bootstrap

> .\b2

> b2 --build-dir="G:\C++\boost-build" --build-type=complete msvc stage

When this last command completed the small report message at the bottom read:

...failed updating 224 targets...
...skipped 20 targets...
...updated 3804 targets...

I don't know if that signifies problems or not.

Everything seems to have worked so far up until the point where I started to try and consume the binaries (Step 6 in the guide).

I added the other lib directory described in step 6.1. Although the lib directory I have is inside the stage directory, not the boost root as described in the guide.

I added this to the "Additional Include Directories", so that string now looks like:

G:\C++\boost\boost_1_61_0;G:\C++\boost\boost_1_61_0\stage\lib

When recompiling, if I remove the first entry I get this error:

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

When I compile with both paths set I get:

LNK1104 cannot open file 'libboost_regex-vc140-mt-1_61.lib'

I've confirmed that the file named is in the directory here:

G:\C++\boost\boost_1_61_0\stage\lib

Pretty confused right now. What have I done wrong here?

Is there a better guide to follow? This guide does seem talk about VS2003 and 2005.

Any advice would be great.

As the name states, "Additional Include Directories" are for the files that you want to #include , which in your case is the G:\\C++\\boost\\boost_1_61_0 directory.

The linker won't search for the libraries in the "Additional Include Directories", because those are not meant to be used for libraries, and it so can't find the boost libraries.

The linker searches "Additional Library Directories" for the required libraries, so you should put the path to the libraries there, ie G:\\C++\\boost\\boost_1_61_0\\stage\\lib .

The property is located in Linker -> General .

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