我在我的机器上用自制软件安装了gcc 11 (Linux20.04)。而且它并不像它所显示的那样运行在vscode上。
as:未被识别的选项‘-g侏儒-5’
我不确定这是不是路径问题。因为当我安装brew的时候它告诉我
Warning: /home/linuxbrew/.linuxbrew/bin/ is not in your PATH.
为了解决这个问题,它建议使用以下三个命令
echo '# Set PATH, MANPATH, etc., for Homebrew.' >> /home/hasib/.profile
echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> /home/hasib/.profile
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
所以我做了那些。我不知道这是不是搞砸了这条路。我对Linux有点陌生,太困惑了。我只想跑gcc-11的比赛。
这是我的tasks.json文件:
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: g++ build active file",
"command": "/usr/bin/g++",
"args": [
"-fdiagnostics-color=always",
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Task generated by Debugger."
},
{
"type": "cppbuild",
"label": "Build with GCC 11.3.0",
"command": "/home/linuxbrew/.linuxbrew/bin/g++-11",
"args": [
"-fdiagnostics-color=always",
"-g",
"-std=c++20",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": "build",
"detail": "compiler: /home/linuxbrew/.linuxbrew/bin/g++-11"
},
{
"type": "cppbuild",
"label": "C/C++: g++-10 build active file",
"command": "/usr/bin/g++-10",
"args": [
"-fdiagnostics-color=always",
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": "build",
"detail": "compiler: /usr/bin/g++-10"
}
],
"version": "2.0.0"
}
launch.json:
{
"version": "0.2.0",
"configurations": []
}
gcc-11 --version
的输出:
gcc-11 (Homebrew GCC 11.3.0) 11.3.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
gdb --version
的输出:
GNU gdb (Ubuntu 9.2-0ubuntu1~20.04.1) 9.2
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
发布于 2022-10-13 04:36:07
as
( GNU )是二进制程序包的一部分。您需要安装一个最新版本的binutils,其中as
支持--gdwarf-5
标志,并确保它是由gcc-11
使用的。
您可以通过运行$PATH来检查$PATH中是否支持该标志。
as --help | grep gdwarf
如果是这样,则返回包含以下行的内容:
--gdwarf-<N> generate DWARF<N> debugging information. 2 <= <N> <= 5
如果没有返回,请尝试通过linuxbrew安装最新版本的binutils (如果没有返回,请重新启动桌面会话,以确保所有终端和vscode都能更新到$PATH等)。
https://stackoverflow.com/questions/74000991
复制相似问题