Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: ehguacho on December 14, 2010, 07:48:26 pm

Title: Classes implementation?
Post by: ehguacho on December 14, 2010, 07:48:26 pm
hi everyone! i've got some problems while implementing classes in Code::Blocks.

i'm trying to create a new class, but when the wizard creates the class i always get this error while running the project:

Code
error: expected '=', ',', ';', 'asm' or '__attribute__' before 'asd'|
||=== Build finished: 1 errors, 0 warnings ===|

this is the code that the wizard generates:

file asd.h

Code
#ifndef ASD_H
#define ASD_H

class asd
{
    public:
        asd();
        virtual ~asd();
    protected:
    private:
};

#endif // ASD_H

file asd.cpp

Code
#include "asd.h"

asd::asd()
{
    //ctor
}

asd::~asd()
{
    //dtor
}

...and this is the code of the project's main file:

Code
#include "asd.h"

int main(void)
{
    return 0;
}

why i'm getting this error!? thank you all in advance!
Title: Re: Classes implementation?
Post by: stahta01 on December 14, 2010, 08:02:45 pm
And, the compiler you are using is ???

Please read and follow
http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_troubleshoot_an_compiler_problem.3F

Tim S.
Title: Re: Classes implementation?
Post by: ehguacho on December 15, 2010, 05:34:37 am
GNU GCC Compiler
Title: Re: Classes implementation?
Post by: Greatwolf on December 15, 2010, 02:32:51 pm
I've tested your code above using gcc 4.4.1 and it works just fine for me. What version of gcc are you using? What's the full commandline being passed by C::B?
Title: Re: Classes implementation?
Post by: ehguacho on December 15, 2010, 06:09:15 pm
sorry, but i don't know what version of GCC i'm using. how to do it?
and sorry again, but what do you mean with "the command line passed by C::B"?

i've tried to download and install MinGW separately of C::B and set to compiler's path to the downloaded MinGW, and nothing... :(
Title: Re: Classes implementation?
Post by: oBFusCATed on December 15, 2010, 06:13:31 pm
Please read and follow
http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_troubleshoot_an_compiler_problem.3F

gcc --version will give you the version of the compiler
Title: Re: Classes implementation?
Post by: ehguacho on December 15, 2010, 06:20:28 pm
problem solved! i was using a C src and should be using a C++ src. changed filename to a CPP extension and worked fine.

thanks anyway!