谁能告诉我Visual Studio 2015 for C++项目内置了什么编译器?我尝试了它并尝试了旧版本的编译器,它给了我其他编译结果.它是GNU C++版本4.8.2还是更新版本?
我决定将我的boost库从1.61更新到1.63,在我更新的项目中使用新文件,我收到一些我以前没有得到的新错误消息:
error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::system_category(void)" (?system_category@system@boost@@YAAEBVerror_category@12@XZ)
error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::generic_category(void)" (?generic_category@system@boost@@YAAEBVerror_category@12@XZ)
Run Code Online (Sandbox Code Playgroud)
由于我的1.63库是使用Visual Studio 2017编译的,我的第一个假设是我在编译boost库时犯了一个错误,所以这里是我从boost文件的一个干净解压缩中得到的总步骤:
boost_1_63_0文件夹中.bootstrap.batproject-config.jam进行编辑using msvc ;改为using msvc : 14.1 : E:\Program Files\Microsoft Visual Studio\VC\Tools\MSVC\14.10.24911\bin\HostX64\x64\;boost/config/auto_link.hpp进行编辑b2 architecture=x86 address-model=64 link=static threading=multi runtime-link=shared --build-type=complete stage --stagedir=stage/x64 -a#define BOOST_LIB_DIAGNOSTIC用于跟踪正在使用的文件(它们是).有谁知道我的错误在哪里?如果我使用在Visual Studio 2017 RC中使用Visual Studio …
我想在项目中使用boost :: thread,并且将CMake用作构建工具。但是,即使是非常简单的设置也会导致两个编译器错误:
main.cpp
#include <boost/thread.hpp>
int main()
{
boost::thread t;
return 0;
}
Run Code Online (Sandbox Code Playgroud)
CMakeLists.txt
cmake_minimum_required (VERSION 2.6)
project (ThreadTest)
set(Boost_USE_STATIC_LIBS OFF)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
find_package(Boost 1.58.0 COMPONENTS random thread)
set(SOURCE_DIR src)
set(SOURCE_FILES
${SOURCE_DIR}/main.cpp
)
if(Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS})
add_executable(test ${SOURCE_FILES})
target_link_libraries(test ${Boost_LIBRARIES})
endif()
Run Code Online (Sandbox Code Playgroud)
我正在使用Boost 1.68.0,CMake可以找到它,并且能够构建正确的Visual Studio项目文件。
我尝试使用boost :: random,它起作用了。
但是,编译上面的程序会导致两个错误消息:
这是error_code.hpp中的引发错误的行
我在boost安装中寻找了文件'libboost_thread-vc14 1 -mt-x64-1_68.lib',但仅找到'boost_1_68_0 \ lib64-msvc-14.0 \ boost_thread-vc14 0 -mt-gd-x64-1_68.lib'
链接器设置包含正确的文件:
所以,我有两个问题: