简体   繁体   中英

Visual Studio not finding boost include files in release mode (works in debug)

I'm using boost with Visual Studio 2013 Express.

Visual Studio finds the #include <boost/filesystem.hpp> in Debug mode, but not in Release mode.

When I try to compile in Release mode, it says:

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

When I right click on the #include directive to open the file manually, it works in Debug configuration, but again not in Release, there it says:

File 'boost/filesystem.hpp' not found in current source file's directory or in build system paths.

I checked the build configurations and

  • C/C++ - > General -> "Additional Include Directories"
  • Linker -> General -> "Additional Library Directories"
  • Linker -> Input -> "Additional Dependencies"

Are the same for both configurations.

Do I need to edit the "build system paths", as the error says? I thought that was what the three options above do.

What else could cause this problem?

Double-check you've checked the settings of the project that actual failed to build. I had the same issue when using boost::optional . I just overlooked that another project ( UnitTests ) was failing, rather than the project I suspected ( CppPlaygroundLib ) due to misinterpreting the build output by focussing on the line containing the error message:

1>------ Build started: Project: UnitTests , Configuration: Release Win32 ------

1> FooTests.cpp

1>c:\\projects\\playground\\cppplayground\\ cppplaygroundlib \\foo.h(3): fatal error C1083: Cannot open include file: 'boost/optional/optional.hpp': No such file or directory

========== Build: 0 succeeded, 1 failed, 2 up-to-date, 0 skipped ==========

After I had added the missing boost path in C/C++->General->Additional Include Directories my solution compiled successfully.

Project Property Pages in Visual Studio are not the same for both configurations. At the Property Page, just set Configuration (top-left) to Release and set configuration for the release build independently.

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