【发布时间】:2021-06-01 08:16:42
【问题描述】:
我正在尝试将大型 c++/python 项目从 Visual Studio 迁移到 vscode(对现在的 Python3.8 支持和 Visual Studio 中落后的 IntelliSense 等感到沮丧)。
所以我已经开始安装 vscode-solution-explorer、C/C++、C++ intellisense、code runner、Python 和其他一些 vscode 扩展,我已经成功构建了 6 个 C++ 项目中的 2 个,但是现在我被困在第三个 c++ 项目上,下面是终端输出的浓缩部分(它依赖于前两个项目,但似乎找到了它们(核心和实用程序))。
....
C:\dev\project\msvc\auxiliary\Intermediate32\Debug\PID.obj
C:\dev\project\msvc\auxiliary\Intermediate32\Debug\SteeringEngine.obj
C:\dev\project\msvc\utils\Debug\utils.lib
C:\dev\project\msvc\core\Debug\core.lib
Creating library C:\dev\project\msvc\auxiliary\..\project_name\systems\cppsystems\auxiliary.cp37-win32.lib and object C:\dev\project\msvc\auxiliary\..\project_name\systems\cppsystems\auxiliary.cp37-win32.exp
<bunch of similar errors>....
SteeringEngine.obj : error LNK2001: unresolved external symbol "public: void __thiscall pysim::Variable::add(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,double *,class std::basic_s
PID.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall pysim::CommonSystemImpl::__preStep(void)" (?__preStep@CommonSystemImpl@pysim@@UAEXXZ) [C:\dev\projects\msvc\auxiliary\auxiliary.vcxproj]
... more similar errors
这是c_cpp_properties.json:
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**",
"C:/Dev/boost_1_71_0/libs/**",
"C:/Dev/boost_1_71_0/**",
"C:/dev/libs/eigen-eigen-da9b4e14c255/**",
"c:/python37-32/**",
"c:/python37-32/include/**",
"C:/dev/project/venv/Lib/site-packages/pysim/include/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"windowsSdkVersion": "10.0.18362.0",
"compilerPath": "C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29333/bin/Hostx86/x86/cl.exe",
"cStandard": "c17",
"cppStandard": "c++17",
"intelliSenseMode": "windows-msvc-x86"
},
{
"name": "Win64",
"includePath": [
"${workspaceFolder}/**",
"C:/Dev/boost_1_71_0/libs/**",
"C:/Dev/boost_1_71_0/**",
"C:/dev/libs/eigen-eigen-da9b4e14c255/**",
"c:/python37-64/**",
"c:/python37-64/include/**",
"C:/dev/project/venv/Lib/site-packages/pysim/include/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"windowsSdkVersion": "10.0.18362.0",
"compilerPath": "C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29333/bin/Hostx64/x64/cl.exe",
"cStandard": "c17",
"cppStandard": "c++17",
"intelliSenseMode": "windows-msvc-x64"
}
],
"version": 4
}
这是tasks.json的第一部分:
{
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"label": "Utils",
"command": "msbuild",
"args": ["${workspaceFolder}\\msvc\\utils\\",
"/property:Configuration=Debug",
"/property:Platform=x86",
],
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": [
"$msCompile"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "compiler: msbuild"
},
{
"type": "shell",
"label": "core",
"command": "msbuild",
"args": ["${workspaceFolder}\\msvc\\core\\"
],
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": [
"$msCompile"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "compiler: cl.exe"
},
{
"type": "shell",
"label": "auxiliary",
"command": "msbuild",
"args": ["${workspaceFolder}\\msvc\\auxiliary\\",
"/t:build",
],
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": [
"$msCompile"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "compiler: msbuild"
},
....
任何建议我做错了什么?
关于 auxilliary.vcproj 中的类似主题,我已经包含了 x32 和 x64 以及调试/发布的路径,如下所示:<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">。我在哪里以及如何选择它? (看起来我选择了 32 位调试,但是在哪里选择的呢?)
【问题讨论】:
标签: c++ visual-studio visual-studio-code