mv cmake-3.9.1-Linux-x86_64 /opt/cmake-3.9.1ln -sf /opt/cmake-3.9.1/bin/* /usr/bin/ 检查下cmake版本 >>>cmake --versioncmake version 3.9.1 3.CMakeList.txt 如果在目录下存在cmakelist.txt则会自动激活vscode最下方的cmake tools插件 4.cmake生成makefile 点击cmake按钮(如果想调试就选...
{"version":"2.0.0","tasks":[{"label":"cmake","type":"shell","command":"cmake","args":["../"],"options":{"cwd":"${fileDirname}/build"},},{"label":"make","type":"shell","command":"make","args":[],"options":{"cwd":"${fileDirname}/build"},},{"label":"build","...
project(SOLIDERFIRE) # 设置编译选项 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") # 设置编译类型 set(CMAKE_BUILD_TYPE Debug) # 设置是否到处编译命令 set(CMAKE_EXPORT_COMPILE_COMMANDS ON) # 头文件 类似g++ -I include_directories(${CMAKE_SOURCE_DIR}/include) add_executable(my_cmake_...
{"version":"2.0.0","tasks":[{"label":"cmake","type":"shell","command":"cmake","args":["../"],"options":{"cwd":"${fileDirname}/build"},},{"label":"make","type":"shell","command":"make","args":[],"options":{"cwd":"${fileDirname}/build"},},{"label":"build","...
本文针对linux平台下的C++代码调试,通常情况下使用vscode调试有以下两种方案: 直接使用C++插件调试,此时需要自行编译。 使用Cmake插件,在配置完成后可以和Clion类似,接管编译和调试等全过程。 本文以方案1为主进行讲解。 一. 前提条件 系统环境:centos7.8软件要求:vscode 1.75.0 、 C++插件 、modern fortran插件(支持...
cmake_minimum_required(VERSION 3.10.2) project("main") set(CMAKE_BUILD_TYPE "Debug") #生成可以debug的可执行文件 file(GLOB cpps ${CMAKE_SOURCE_DIR}/src/*.cpp) add_executable(${PROJECT_NAME} ${cpps} ) message(STATUS "what we have: ${cpps}") ...
在VSCODE中运行创建的这两个task(“cmake"和"make”)来进行编译。 Debug 在.vscode文件夹下面创建launch.json { "version": "0.2.0", "configurations": [ { "name": "(gdb) Launch", "type": "cppdbg", "request": "launch", "program": "${workspaceFolder}/build/src/app/epoll_server", ...
3、在vscode中调试CMake工程代码 1. 在菜单中, 选择Run->Add Configuration,生成一个空白launch.json文件 2. 替换内容如下: {"version":"0.2.0","configurations": [ {"name":"g++ - Build and debug active file","type":"cppdbg","request":"launch","program":"${fileDirname}/build/${fileBasenam...
1) apt-get install g++ 2) 安装vscode 并安装插件(c++, cmake tools)2.2 测试代码 随意整个main...
1. 首先安装vscode,去官网https://code.visualstudio.com/里面选择对应的linux版本下载就行了,我在ubunut下下载的是.deb文件,可以直接双击安装 安装之后呢,这个vscode在命令行里面的名称叫code,这个有点意思,我也不知道为啥不叫vscode 2. 安装插件,主要是装几个cmake和c++的一些插件 ...