VScode(C/C++)自动生成launch.json+cmake断点调试
VScode(C/C++)自动生成launch.json+cmake断点调试
问题1:VScode 最新版本1.12.4不能自动生成launch.json和task.json文件
解决办法:
编辑好main.cpp文件,点击“F5”,就会自动生成launch.json和task.json文件,完成编译,输出结果。
问题2:接下来,使用cmake指令编译时,报错:
CMake Deprecation Warning at CMakeLists.txt:12 (cmake_minimum_required):
Compatibility with CMake < 2.8.12 will be removed from a future version of
CMake.
Update the VERSION argument value or use a … suffix to tell
CMake that the project does not need compatibility with older versions.
CMake Error at CMakeLists.txt:14 (project):
Running
‘nmake’ ‘-?’
failed with:
系统找不到指定的文件。
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
– Configuring incomplete, errors occurred!
See also “E:/software_cpp/test_launch.json/build/CMakeFiles/CMakeOutput.log”.
解决方法:
第一步,在根目录确保已经编辑好CMakeLists.txt,然后点击VSCODE最下方 CMake:[debug],


然后点击最下方 “Build”,就会在build文件夹下生成main.exe;
或者直接在 “终端”中 输入 “make”,也会在build文件夹下生成main.exe;
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐


所有评论(0)