News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Why class is not supported in GTK new project???

Started by denisco, January 10, 2009, 05:28:24 PM

Previous topic - Next topic

denisco

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?


frithjofh

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

denisco

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.

stahta01

#3
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
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

MortenMacFly

Quote from: stahta01 on January 11, 2009, 05:58:12 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: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]