How to set NetBeans IDE pkg-config --cflags --libs gtk+-2.0?
Does anyone know how to apply this in specifically in NetBeans IDE? I have tried to include -lgtk+-2.0 or same line as additional option but always it shows gcc: error: gtk+-2.0: No such file or directory
If i do like this manually it works. But i want to apply it in IDE way:
gcc $(pkg-config --cflags --lib开发者_开发问答s gtk+-2.0 more) -o main main.c
In Project Properties -> Build -> C Compiler, you can set as 'Additional Options'
$$(pkg-config --cflags --libs gtk+-2.0 more)
note the double-$, otherwise NetBeans will treat it like one of its own parameters.
It seems like you'd still need to include the additional include directory (e.g. /usr/include/gtk+-2.0) by hand, though -- General->Include Directories does not let you specify a shell expression to be evaluated. It won't stop the compilation, but it'd just make the IDE not be able to find the headers and thus give you code assistance.
Current NetBeans version (v7.2.1) supports pkg-config libraries. Just add the according library under Linker settings and pkg-config --cflags foo
will be added automagically to the additional compiler options.
On the latests version (i.e netbeans 8.2) , you should do:
Project Properties -> Build -> Linker ->libraries -> Add pkgConfig Library, and then pick the relevant package, thats it!
精彩评论