I am trying to compile the simple C example from this Tutorial on Ubuntu using gcc. What do I have to use as argument for gcc to include the needed libraries for #include <libappindicator/app-indicator.h>
?
相关问题
- Multiple sockets for clients to connect to
- Is shmid returned by shmget() unique across proces
- What is the best way to do a search in a large fil
- glDrawElements only draws half a quad
- how to get running process information in java?
Use the
-l
command line option. You can specify the library search path with the-L
option. E.g:This will link
myprogram
with the static librarylibfoo.a
in the folder/home/me/foo/lib
.What you are trying to do here is making a gtk app, the above solutions are as applicable anywhere like using the -l option and -I option,
However for GTK apps you may also use pkg-config which make it easier as your paths can be predefined
http://www.freedesktop.org/wiki/Software/pkg-config
An interesting example can be found here http://developer.gnome.org/gtk/2.24/gtk-compiling.html
What I do is:
pkg-config will fetch the required include and lib flags for
libappindicator
and it's dependencies. This assumeslibappindictaor-dev
package is already installed.If you used
apt-get
,Synaptic Package Manager
, etc. to get theappindicator
library (vs. building it from source), did you only install thelibappindicator1
package or did you also installlibappindicator-dev
to get thelibappindicator
header files? Linux packages very often have split the runtime libraries from the compile-time headers. That way people who only need the libraries to satisfy a dynamic link don't have to install unneeded headers. But since you're doing development you need those headers and therefore need thelibappindicator-dev
package as well.