Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: denisco on January 10, 2009, 05:28:24 pm

Title: Why class is not supported in GTK new project???
Post by: denisco on January 10, 2009, 05:28:24 pm
I made first a simple project using the new gtk project...
At this point build fine and everything.
when I add my own code of C++ "something .cpp" the compiler treath C++ "class" as an error?

I made a C++ console app to see what would be different
beside the `pkg-config gtk+-2.0 --cflags` and -fexception

what do I have to do here?

Title: Re: Why class is not supported in GTK new project???
Post by: frithjofh on January 10, 2009, 06:01:33 pm
Hi,

could it be that Gtk is C and you are trying to use a C++ construct by using class?
And could you add some code please to understand the matter better?

Regards

nausea
Title: Re: Why class is not supported in GTK new project???
Post by: denisco on January 11, 2009, 12:30:40 am
First of all I do have that project with GTK mix C and C++, build and worked fine.
Now I am trying to convert that project into codeblocks and it complains at

class CSize {
    int w, h;
};

/home/denisco/workspace/iWebBrowser/WinXDef.h|444|error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘CSize’|

Hope that helps.
Title: Re: Why class is not supported in GTK new project???
Post by: stahta01 on January 11, 2009, 05:58:12 am
Just a few guesses at cause.

Guess 1:
  Code::Blocks assumes all files with extension .c is an C file.
  Change extension to cpp if doing C++ and does it change error?


Guess 2:
  In header, add an line of
  class CSize;
  before using CSize.

  This assumes CSize is not defined in header before errors.

Guess 3:
   That the name CSize is already used somewhere in an header; if so change name.

Tim S
Title: Re: Why class is not supported in GTK new project???
Post by: MortenMacFly on January 11, 2009, 10:45:33 am
Just a few guesses at cause.
Enough help.
denisco: Mind not posting questions not related to C::B? This violates our forum rules in case you don't know.
Topic locked.