gpt4 book ai didi

c - 在 Ubuntu 16.04 上找不到 printf.c

转载 作者:太空宇宙 更新时间:2023-11-04 07:52:55 25 4
gpt4 key购买 nike

我最近切换到 Ubuntu 16.04。我在 Ubuntu 上使用 vscode 作为 IDE。我配置了其他语言,但我无法为 C/C++ 执行此操作。我创建了 c_cpp_properties.json、launch.json 和 tasks.json。当我开始编译任何给定的代码时,当合适的功能如 printfmalloc 时,它会给出错误。错误信息:

Unable to open 'printf.c': File not found (file:///build/glibc-Cl5G7W/glibc-2.23/stdio-common/printf.c).

我该如何解决这个问题?

launch.json

{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/test.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask": "build"
}
]
}

tasks.json

{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"type": "shell",
"command": "gcc",
"args": [
"-g",
"pointer_revision.c",
"-o",
"test.exe"
],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}

c_cpp_properties.json

{
"configurations": {
"name": "Linux",
"includePath": [
"${workspaceFolder}",
"/usr/include/x86_64-linux-gnu/5/include",
"/usr/local/include",
"/usr/include/x86_64-linux-gnu/5/include-fixed",
"/usr/include/x86_64-linux-gnu",
"/usr/include"
],
"defines": [],
"intelliSenseMode": "clang-x64",
"browse": {
"path": [
"${workspaceFolder}",
"/usr/include/x86_64-linux-gnu/5/include",
"/usr/local/include",
"/usr/include/x86_64-linux-gnu/5/include-fixed",
"/usr/include/x86_64-linux-gnu",
"/usr/include"
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
},
"compilerPath": "/usr/bin/gcc"
}
}

最佳答案

不幸的是,Debian 和 Ubuntu 没有将源代码作为调试包的一部分提供。据我所知,没有计划将资源作为 dbgsym packages 的一部分发送, 要么。

相比之下,Fedora 及其下游发行版具有广泛的基础架构来准备可用的源文件以进行调试。这样做并非易事,因为它需要重写 DWARF 数据中的文件路径,从构建树位置到安装位置。但它对调试确实很有帮助,并为整个发行版提供了很好的自由软件风格。

关于c - 在 Ubuntu 16.04 上找不到 printf.c,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52650371/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com