[Seek Help] 使用vscode时无法避开的一个问题
Tofloor
poster avatar
173******39
deepin
2022-08-08 07:58
Author

截图_选择区域_20220807235430.png

在网上找了很久的资料,系统从ubuntu换到了deepin,这个问题都没有解决。

launch.json&tasks.json无论如何修改都会出现同样的问题

gcc&clang之类的软件全部都安装上啦

现在手足无措,不知道该如何才好部署C语言环境。

Reply Favorite View the author
All Replies
173******39
deepin
2022-08-08 07:59
#1

不知道重装系统有没有可能解决这个问题?

Reply View the author
joo
deepin
2022-08-08 08:20
#2
It has been deleted!
SamLukeYes
deepin
2022-08-08 09:29
#3

ls -l 看看?

Reply View the author
173******39
deepin
2022-08-08 15:13
#4
SamLukeYes

ls -l 看看?

请问这是什么意思啊?

Reply View the author
牧野
deepin
2022-08-08 16:05
#5

先用命令行试试编译可不可以,确认编译环境没问题,接下来就要看两个json配置文件,把它们贴出来。肯定不是系统的问题,用vscode要先了解gcc,make命令,学会cmake,才能真的编写调试管理多文件工程!

Reply View the author
fxbszj
deepin
2022-08-08 17:00
#6

第一,你不会配置

第二,vscode并不是一个新手友好的c/c++开发环境

Reply View the author
173******39
deepin
2022-08-08 17:13
#7
牧野

先用命令行试试编译可不可以,确认编译环境没问题,接下来就要看两个json配置文件,把它们贴出来。肯定不是系统的问题,用vscode要先了解gcc,make命令,学会cmake,才能真的编写调试管理多文件工程!

截图_选择区域_20220808091306.png
截图_选择区域_20220808091255.png

Reply View the author
SamLukeYes
deepin
2022-08-08 17:24
#8
173******39

请问这是什么意思啊?

在 vscode 当前的工作区打开终端,执行这个命令,把结果发出来看一下

Reply View the author
173******39
deepin
2022-08-08 17:55
#9
SamLukeYes

ls -l 看看?

t
截图_deepin-terminal_20220808095245.png

Reply View the author
SamLukeYes
deepin
2022-08-08 18:08
#10
173******39

t
截图_deepin-terminal_20220808095245.png

我是说在 vscode 工作区的终端里执行这个命令啊,不是要看你的家目录啊scream

如果你已经把之前准备的工作目录删了,那你镇楼图里的报错也没有意义了,咱也不知道你想干什么doubt

Reply View the author
寂静的羽夏
deepin
2022-08-08 18:14
#11

配置不对,我整天用 vscode,写过 C/C++ 等等也没遇到这种情况,你应该需要补充 Linux 相关基础知识,什么是路径、什么是编译器、编译器和连接器为你做什么,命令行的含义是啥,gdb是啥,你一点都不清楚,只是知道这么做。我给你我的配置供参考,自己好好想想为什么这么写:

tasks.json:

{
    "tasks": [
        {
            "type": "cppbuild",
            "label": "gcctask",
            "command": "/usr/bin/gcc",
            "args": [
                "-fdiagnostics-color=always",
                "-g",
                "${file}",
                "-o",
                "${fileDirname}/${fileBasenameNoExtension}"
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "调试器生成的任务。"
        }
    ],
    "version": "2.0.0"
}

launch.json:


{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Debug",
            "type": "cppdbg",
            "request": "launch",
            "args": [],
            "program": "${fileDirname}/${fileBasenameNoExtension}",
            "cwd": "${fileDirname}",
            "MIMode": "gdb",
            "miDebuggerPath": "/usr/bin/gdb",
            "preLaunchTask": "gcctask"
        }
    ]
}
Reply View the author
joo
deepin
2022-08-09 01:51
#12

花30~60分钟看看这个文档:https://code.visualstudio.com/docs/cpp/config-linux

Reply View the author