Re: Help Using Gdk_image



On Tue, 2005-11-29 at 15:36 +0000, Axel Simon wrote:
On Tue, 2005-11-29 at 15:07 +0000, Michael Noonan wrote:
Hello,

I'm new to using gtk and would really appreciate it if
anybody could help me. 

snip, snip...

#include <stdio.h>
#include <gtk/gtk.h>
#include <gdk/gdktypes.h>
using namespace std;

this is C++, shouldn't be there


Since you didn't mention compile-time errors, it's likely that you're
anticipating using C++ for your work.  If that's the case, wrap all your
#includes of C headers like so:

extern "C" {
  #include <stdio.h>
  #include <gtk/gtk.h>
  #include <gdk/gdktypes.h>
}

And just for completeness, the "using namespace" isn't necessary until
you do something to include a C++ namespace, such as:

#include <iostream>

You also have to be careful about making all your GUI callbacks "static
public".  

Using C++ with GTk isn't too hard.  I recommend using good design
practice and putting all your gui-related code into one class (which is
a pretty good idea anyway) to isolate such issues as these.

-- 
Daryl Lee
Open the Present--It's a Gift.




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