VS Community 2017编译报错LNK1104:无法打开指定boost库文件,求原因
boost_python3-vc141-mt-x64-1_66.lib in VS Community 2017 Since you've already verified the basic configurations (correct library name in additional dependencies, active x64 platform, and proper additional library directory path), let's dive into the less obvious causes that could still trigger this error:
Missing or incorrectly compiled Boost.Python library
Double-check if the fileboost_python3-vc141-mt-x64-1_66.libactually exists inC:\boost_1_66_0\stage\lib. Boost.Python doesn't build all variants by default—you might have forgotten to specify Python 3 as the target version when compiling Boost. If the file isn't there, you'll need to recompile Boost with the correct Python 3 parameters (usingb2withpython=3.xflags, ensuring you're targeting x64 architecture during the build).Mismatched Debug/Release configuration
Themtsuffix in the library name indicates it's a Release-mode multi-threaded library. If your VS project is currently set to Debug mode, you'll need the Debug variant of the library (named something likeboost_python3-vc141-mt-gd-x64-1_66.lib). Conversely, if you're in Release mode but only have the Debug library compiled, you'll hit this error. Confirm your project's active configuration matches the library's build type.Python version mismatch
Thepython3prefix means this library was compiled for a specific Python 3.x version (e.g., 3.6, 3.7). If your project is linked against a different Python version (or you compiled Boost with a different Python version than what's referenced in your project), the library might not exist or be incompatible. Verify that the Python version used to compile Boost matches the one configured in your VS project.Toolset mismatch during Boost compilation
Thevc141suffix corresponds to the VS 2017 toolset. If you compiled Boost using an older toolset (like vc140 for VS 2015), the library files will havevc140in their names instead. Make sure you built Boost with the vc141 toolset to match your VS 2017 environment.Incorrect library directory scope
Ensure the additional library directoryC:\boost_1_66_0\stage\libis configured for the active project configuration and platform. Sometimes users set the path in the "General" configuration but forget to apply it to specific configurations (e.g., Debug vs Release) or platforms. Right-click your project → Properties → Configuration Properties → Linker → General, and confirm the path is present under the correct active configuration (e.g., Release | x64).File system permissions
If thestage\libdirectory or the library file itself has restricted permissions, VS might not be able to access it when linking. Try running Visual Studio as an administrator, or adjust the permissions onC:\boost_1_66_0to allow read access for your user account.
内容的提问来源于stack exchange,提问作者Denis Franck

