Re: Can I include glib, gtk .h files in a .cc files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Feb 04, 2010 at 12:14:17AM -0800, Peter Fletcher wrote:
> Can you please tell me if I can include glib.h, gtk/gtk.h files in my .cc
> files?

Definitely.

> I have the following compiling problems:
> Launcher/MyController.cc:2:18: error: glib.h: No such file or directory
> Launcher/MyController.cc:6:21: error: gtk/gtk.h: No such file or directory
> 
> But when I rename my .cc files to .c file, then the compiler compiles fine.

Then you pass the -I flags specifying the library locations only to the
C compiler, not to the C++ compiler.

This has nothing to do with the possibility to include Gtk+ headers;
just your Makefile (or whatever you use) is broken.  So fix it and pass
the correct -I flags to the C++ compiler too (ideally obtain the flags
using pkg-config --cflags).

> I don't explicitly call any gtk functions in MyController.cc, I just need to
> #include glib.h, gtk/gtk.h because some other .h needs it.

So, in addition, this other header is broken.  Headers that require
something to be #included should #include it themselves.  If it's your
header fix it.  If it isn't complain.

Yeti

_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux