Reputation: 55
So I ran into this error today when working with GTK-3.0, Linux seems to be confused about how to include header files, because normally I'd use #include <gtk/gtk.h>
but because that doesn't work I have to add <gtk-3.0/gtk/gtk.h>
. This is what my c_cpp_properties.json
file looks like.
Adding /usr/include/gtk-3.0
seemed like a solution, but because gtk.h
is dependent on other libraries I have to find out how I can make VSCode look for files recursively. I already tried /usr/local/include/*
but with no success.
{
"configurations": [
{
"name": "Linux",
"defines": [],
"includePath": [
"/usr/local/include",
],
"compilerPath": "/usr/bin/gcc",
"cStandard": "c11",
"cppStandard": "c++14",
"intelliSenseMode": "clang-x64"
}
],
"version": 4 }
Upvotes: 0
Views: 430
Reputation: 7305
The pkg-config
command is usually used to determine all the dependancies and flags needed.
The output of pkg-config --cflags gtk+-3.0
should give you all the compiler flags and pkg-config --libs gtk+-3.0
all the linker flags.
pkg-config
also has a --static
flag if you need static linking (which requires more dependancies to be linked) and a --msvc-syntax
flag to generate MSVC-style flags.
Usually you call these commands in your configure or build tools (e.g. in Makefile
or in configure
). Even if you use Code::Blocks you can call pkg-config
by surrounding it with backticks.
Upvotes: 1