包含 VS_Code 的路径

问题描述 投票:0回答:1

尝试使用 GTK 库启动 C 程序。 IDE指点找不到gtk.h,建议写在c_cpp_properties.json里。

当我这样做时——将它写在“includePath”中,它说它找不到路径,因为它认为路径是相对的——IDE 试图查看我的程序文件夹,而不是将路径视为绝对路径。我怎么能指出路径是绝对的? 谢谢。

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**",
                "С:/CodeBlocks/GTK/include/gtk-2.0/gtk"
                
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "compilerPath": "c:\\CodeBlocks\\MinGW\\bin\\gcc.exe",
            "cStandard": "c17",
            "cppStandard": "gnu++14",
            "intelliSenseMode": "windows-gcc-x86",
            
            }
        }
    ],
    "version": 4
}

c_cpp_properties.json 的确切信息是:

找不到 d:\ProgProg\Sheremet_C\C_prog_2\С:\CodeBlocks\GTK\include\gtk-2.0\gtk.

程序文件中的错误信息:

#include 检测到错误。请更新您的 includePath。此翻译单元 (D:\ProgProg\Sheremet_C\C_prog_2\main.c) 禁用了波浪线。C/C++(1696) 无法打开源文件“gtk/gtk.h”C/C++(1696)”。

我的VS Code安装在C:下,工作区文件夹在D:下,我的GTK在C:下。

c visual-studio-code gtk
1个回答
0
投票

"С:/CodeBlocks/GTK/include/gtk-2.0/gtk"
格式不正确。

应该是:

"С:\\CodeBlocks\\GTK\\include\\gtk-2.0\\gtk"

© www.soinside.com 2019 - 2024. All rights reserved.