ROS——VScode编译ROS工程
文章目录
- 1.配置环境
- 2.编译
1.配置环境
1.1 在工程目录下创建文件夹.vscode
1.2 在文件夹.vscode
中添加文件c_cpp_properties.json
将下面内容添加到文件c_cpp_properties.json
中
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [],
"compilerPath": "/usr/bin/gcc",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "gcc-x64",
"compileCommands": "${workspaceFolder}/build/compile_commands.json"
}
],
"version": 4
}
1.3 在文件夹.vscode
中添加文件settings.json
写入下面内容:
{
"files.associations": {
"ostream": "cpp",
"deque": "cpp",
"forward_list": "cpp",
"list": "cpp",
"array": "cpp",
"*.tcc": "cpp",
"memory": "cpp",
"future": "cpp",
"istream": "cpp",
"functional": "cpp",
"tuple": "cpp",
"utility": "cpp",
"variant": "cpp",
"string": "cpp",
"cctype": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"csignal": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"any": "cpp",
"atomic": "cpp",
"hash_map": "cpp",
"hash_set": "cpp",
"strstream": "cpp",
"bitset": "cpp",
"chrono": "cpp",
"codecvt": "cpp",
"complex": "cpp",
"condition_variable": "cpp",
"cstdint": "cpp",
"unordered_map": "cpp",
"unordered_set": "cpp",
"vector": "cpp",
"exception": "cpp",
"algorithm": "cpp",
"filesystem": "cpp",
"iterator": "cpp",
"map": "cpp",
"memory_resource": "cpp",
"numeric": "cpp",
"optional": "cpp",
"random": "cpp",
"ratio": "cpp",
"set": "cpp",
"string_view": "cpp",
"system_error": "cpp",
"type_traits": "cpp",
"fstream": "cpp",
"initializer_list": "cpp",
"iomanip": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"limits": "cpp",
"mutex": "cpp",
"new": "cpp",
"shared_mutex": "cpp",
"sstream": "cpp",
"stdexcept": "cpp",
"streambuf": "cpp",
"thread": "cpp",
"cfenv": "cpp",
"cinttypes": "cpp",
"typeindex": "cpp",
"typeinfo": "cpp",
"bit": "cpp",
"*.ipp": "cpp",
"core": "cpp"
},
"python.autoComplete.extraPaths": [
"/home/lanx/Program/UAVs/devel/lib/python3/dist-packages",
"/opt/ros/noetic/lib/python3/dist-packages"
],
"cmakeFormat.exePath": "/usr/local/bin/cmake-format"
}
1.4 在文件夹.vscode
中添加文件tasks.json
写入下面内容:
{
"version": "2.0.0",
"tasks": [
{
"label": "catkin_make", //代表提示的描述性信息
"type": "shell", //可以选择shell或者process,如果是shell代码是在shell里面运行一个命令,如果是process代表作为一个进程来运行
"command": "catkin_make",//这个是我们需要运行的命令
"args": [],//如果需要在命令后面加一些后缀,可以写在这里,比如-DCATKIN_WHITELIST_PACKAGES=“pac1;pac2”
"group": { "kind":"build","isDefault":true},
"presentation": {
"reveal": "always"//可选always或者silence,代表是否输出信息
},
"problemMatcher": "$msCompile"
},
]
}
2.编译
- 先在命令窗口中
catkin_make
工程; - 再依次点击点击左上角
Terminal
->Run Build Task
即可; - 后面修改代码后只需执行步骤2.2即可;
还没有评论,来说两句吧...