VS Code 配置QT程序开发

 

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"
    }
}

 

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值