QT Creator中的代码显示效果不太友善,个人还是比较喜欢使用VS Code进行代码编写。毕竟VS Code集成了很多优秀的插件(主要是本人目前对QT Creator用的不太熟)。
我的很多路径都是写死的,因为工程路径是固定的。目前只能编译运行,但是无法调试,还没找到原因,暂时还是用QT Creator进行调试的。等找到解决的方式再更新本文。
launch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "qt build and debug active file",
"type": "cppdbg",
"request": "launch",
"program": "/home/kylin-fc/forkGit/ukui-control-center/build/ukui-control-center",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "为 gdb 启用整齐打印",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask": "make build activefile",
"miDebuggerPath": "/usr/bin/gdb"
}
]
}
tasks.json:
{
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"label": "mkdir build folder",
"command": "cd /home/kylin-fc/forkGit/ukui-control-center && mkdir -p build/",
"args": [],
"options": {},
"problemMatcher": [],
"group": "build"
},
{
"type": "shell",
"label": "qmake build makefile",
"command": "cd /home/kylin-fc/forkGit/ukui-control-center/build && /usr/bin/qmake .. -spec linux-g++ CONFIG+=debug CONFIG+=qml_debug",
"args": [],
"options": {},
"problemMatcher": [],
"group": "build",
"dependsOn":["mkdir build folder"]
},
{
"type": "shell",
"label": "make build activefile",
"command": "cd /home/kylin-fc/forkGit/ukui-control-center/build && /usr/bin/make",
"args": [],
"options": {},
"problemMatcher": [],
"group": "build",
"dependsOn": ["qmake build makefile"]
}
]
}
c_cpp_properties.json:
{
"version": 4,
"configurations": [
{
"name": "gcc_64",
"intelliSenseMode": "gcc-x64",
"includePath": [
"/usr/include/x86_64-linux-gnu/qt5/**",
"/usr/include/glib-2.0/**",
"/usr/include/gio-unix-2.0/*",
"/usr/lib/x86_64-linux-gnu/glib-2.0/include",
"${workspaceRoot}/**"
],
"browse": {
"path": [
"${workspaceRoot}"
]
},
"compilerPath": "/usr/bin/gcc",
"cStandard": "c11",
"cppStandard": "c++11"
}
]
}
settings.json:
{
"files.associations": {
"qcoreapplication": "cpp",
"qthread": "cpp"
}
}