vscode cmake 从 visual studio 17 移动到 19
vscode cmake move from visual studio 17 to 19
我一直在使用 vscode 与 visual studio 社区版 2017 的 cmake 集成。我只使用 visual studio 与 vscode 的集成,而不是 IDE。我刚搬到 Vstudio 19。现在 cmake 失败了,因为我无法让它识别它应该使用新的 visual studio。请参阅下面的错误输出。
真正有趣的是,它使用了 VS19 文件夹中的正确 cmake.exe,但它使用的参数是“-G”Visual Studio 15 2017”,这是导致问题的原因。我删除了我的 .vscode 文件夹中的 c_cpp_properties.json 文件(然后是 CMake:Clean/Rebuild),该文件引用了 VS17,但没有帮助。
我已尝试删除所有扩展(C/C++ 扩展包),检查我项目中的每个 folder/file 以查找对 VS 17 的引用。删除了构建文件夹和 CMake: Clean/Rebuild 重新安装扩展后..
[variant] Loaded new set of variants
[kit] Successfully loaded 4 kits from C:\Users\wood\AppData\Local\CMakeTools\cmake-tools-kits.json
[main] Configuring folder: mycode
[proc] Executing command: "C:\Program Files (x86)\Microsoft Visual Studio19\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -Hc:/Users/wood/mycode/build -G "Visual Studio 15 2017" -T host=x64 -A win32
[proc] Executing command: "C:\Program Files (x86)\Microsoft Visual Studio19\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -Hc:/Users/wood/mycode -Bc:/Users/wood/OneDrive/mycode/build -G "Visual Studio 15 2017" -T host=x64 -A win32
[cmake] Not searching for unused variables given on the command line.
[cmake] CMake Error at CMakeLists.txt:13 (project):
[cmake] Generator
[cmake]
[cmake] Visual Studio 15 2017
[cmake]
[cmake] could not find any instance of Visual Studio.
[cmake]
[cmake]
[cmake]
[cmake] -- Configuring incomplete, errors occurred!
[cmake] See also "C:/Users/wood/OneDrive/mycode/build/CMakeFiles/CMakeOutput.log".
知道 -G 设置的其他来源吗?
找了 24 小时,发布了一个问题,然后在前五分钟解决了。
我删除了文件。
C:\Users\wood\AppData\Local\CMakeTools\cmake-tools-kits.json
嗯,只是改名了。
卸载了 C/C++ 扩展包,然后重新安装了扩展包。看起来有一个重新扫描 visual studio 的命令,但我错过了它。重建 cmake 时,我被要求选择架构,一切都恢复正常了。
重新扫描 visual studio,使用正确的引用重新创建了 cmake-tools-kits.json 文件。
我一直在使用 vscode 与 visual studio 社区版 2017 的 cmake 集成。我只使用 visual studio 与 vscode 的集成,而不是 IDE。我刚搬到 Vstudio 19。现在 cmake 失败了,因为我无法让它识别它应该使用新的 visual studio。请参阅下面的错误输出。
真正有趣的是,它使用了 VS19 文件夹中的正确 cmake.exe,但它使用的参数是“-G”Visual Studio 15 2017”,这是导致问题的原因。我删除了我的 .vscode 文件夹中的 c_cpp_properties.json 文件(然后是 CMake:Clean/Rebuild),该文件引用了 VS17,但没有帮助。
我已尝试删除所有扩展(C/C++ 扩展包),检查我项目中的每个 folder/file 以查找对 VS 17 的引用。删除了构建文件夹和 CMake: Clean/Rebuild 重新安装扩展后..
[variant] Loaded new set of variants
[kit] Successfully loaded 4 kits from C:\Users\wood\AppData\Local\CMakeTools\cmake-tools-kits.json
[main] Configuring folder: mycode
[proc] Executing command: "C:\Program Files (x86)\Microsoft Visual Studio19\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -Hc:/Users/wood/mycode/build -G "Visual Studio 15 2017" -T host=x64 -A win32
[proc] Executing command: "C:\Program Files (x86)\Microsoft Visual Studio19\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -Hc:/Users/wood/mycode -Bc:/Users/wood/OneDrive/mycode/build -G "Visual Studio 15 2017" -T host=x64 -A win32
[cmake] Not searching for unused variables given on the command line.
[cmake] CMake Error at CMakeLists.txt:13 (project):
[cmake] Generator
[cmake]
[cmake] Visual Studio 15 2017
[cmake]
[cmake] could not find any instance of Visual Studio.
[cmake]
[cmake]
[cmake]
[cmake] -- Configuring incomplete, errors occurred!
[cmake] See also "C:/Users/wood/OneDrive/mycode/build/CMakeFiles/CMakeOutput.log".
知道 -G 设置的其他来源吗?
找了 24 小时,发布了一个问题,然后在前五分钟解决了。
我删除了文件。 C:\Users\wood\AppData\Local\CMakeTools\cmake-tools-kits.json
嗯,只是改名了。
卸载了 C/C++ 扩展包,然后重新安装了扩展包。看起来有一个重新扫描 visual studio 的命令,但我错过了它。重建 cmake 时,我被要求选择架构,一切都恢复正常了。
重新扫描 visual studio,使用正确的引用重新创建了 cmake-tools-kits.json 文件。