任我行549 2022-11-06 16:28 采纳率: 100%
浏览 214
已结题

VScode不能识别头文件#include提示更新includepath

img


VScode提示我更新includepath,但我include path 已经填过添加项了啊?怎么回事,帮帮我。

img

  • 写回答

1条回答 默认 最新

  • 谢玄. 2022-11-06 16:39
    关注

    没有配置好环境
    launch.json文件写入下面的
    也可以看这篇文章https://blog.csdn.net/ambition_zhou/article/details/104509116
    miDebuggerPath 改成 自己电脑的gdb 的路径

    {
        "version": "0.2.0",
        "configurations": [
            {
                "name": "(Windows) Launch",
                "type": "cppvsdbg",
                "request": "launch",
                "program": "cmd",
                "preLaunchTask": "echo",
                "args": [
                    "/C",
                    "${workspaceFolder}/${fileBasenameNoExtension}.exe",
                    "&",
                    "echo.",
                    "&",
                    "pause"
                ],
                "stopAtEntry": false,
                "cwd": "${workspaceFolder}",
                "environment": [],
                "externalConsole":true
            },
            {
                "name": "(gdb) Launch",
                "type": "cppdbg",
                "request": "launch",
                "program": "${workspaceFolder}/${fileBasenameNoExtension}.exe",
                "args": [],
                "stopAtEntry": false,
                "cwd": "${workspaceFolder}",
                "environment": [],
                "externalConsole": true,
                "MIMode": "gdb",
                "miDebuggerPath": "D:\\Programming\\mingw64\\bin\\gdb.exe",// 自己电脑的gdb
                "preLaunchTask": "echo",//这里和task.json的label相对应
                "setupCommands": [
                    {
                        "description": "Enable pretty-printing for gdb",
                        "text": "-enable-pretty-printing",
                        "ignoreFailures": true
                    }
                ]
     
            }
        ]
    }
    

    c_cpp_properties.json这个文件类似于下面的,添加进自己的库

    {
        "configurations": [
            {
                "name": "Win32",
                "includePath": [
                    "${workspaceRoot}",
                    "D:/Programming/mingw64/include/**",
                    "D:/Programming/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++",
                    "D:/Programming/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include/**",
                    "D:/Programming/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/x86_64-w64-mingw32",
                    "D:/Programming/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/backward",
                    "D:/Programming/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include",
                    "D:/Programming/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include-fixed",
                    "D:/Programming/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/include",
                    "D:/Programming/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/include/**"
                ],
                "defines": [
                    "_DEBUG",
                    "UNICODE",
                    "__GNUC__=6",
                    "__cdecl=__attribute__((__cdecl__))"
                ],
                "intelliSenseMode": "msvc-x64",
                "browse": {
                    "limitSymbolsToIncludedHeaders": true,
                    "databaseFilename": "",
                    "path": [
                        "${workspaceRoot}",
                        "D:/Programming/mingw64/include/**",
                        "D:/Programming/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++",
                        "D:/Programming/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/x86_64-w64-mingw32",
                        "D:/Programming/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/backward",
                        "D:/Programming/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include",
                        "D:/Programming/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include-fixed",
                        "D:/Programming/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/include"
                    ]
                }
            }
        ],
        "version": 4
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论 编辑记录

报告相同问题?

问题事件

  • 系统已结题 11月14日
  • 已采纳回答 11月6日
  • 创建了问题 11月6日

悬赏问题

  • ¥15 关于温度改变石墨烯介电性能(关键词-介电常数)
  • ¥150 HDMI分路器LT86102 的输出在890MHz频点处EMC超标8DB
  • ¥15 druid(相关搜索:数据库|防火墙)
  • ¥15 大一python作业
  • ¥15 preLaunchTask"C/C++: aarch64- apple-darwin22-g++-14 生成活动 文件”已终止,退出代码为-1。
  • ¥60 如何鉴定微信小程序数据被篡改过
  • ¥18 关于#贝叶斯概率#的问题:这篇文章中利用em算法求出了对数似然值作为概率表参数,然后进行概率表计算,这个概率表是怎样计算的呀
  • ¥20 C#上传XML格式数据
  • ¥15 elementui上传结合oss接口断点续传,现在只差停止上传和继续上传,各大精英看下
  • ¥20 手机截图相片分辨率降低一半