Author Topic: Why class is not supported in GTK new project???  (Read 4768 times)

Offline denisco

  • Single posting newcomer
  • *
  • Posts: 8
Why class is not supported in GTK new project???
« 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?


Offline frithjofh

  • Regular
  • ***
  • Posts: 376
Re: Why class is not supported in GTK new project???
« Reply #1 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
architect with some spare time  -  c::b compiled from last svn  -   openSuSE leap x86_64  -  AMD FX-4100

Offline denisco

  • Single posting newcomer
  • *
  • Posts: 8
Re: Why class is not supported in GTK new project???
« Reply #2 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.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7785
    • My Best Post
Re: Why class is not supported in GTK new project???
« Reply #3 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
« Last Edit: January 11, 2009, 06:11:32 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9723
Re: Why class is not supported in GTK new project???
« Reply #4 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.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ