News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

Classes implementation?

Started by ehguacho, December 14, 2010, 07:48:26 PM

Previous topic - Next topic

ehguacho

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:

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


this is the code that the wizard generates:

file asd.h

#ifndef ASD_H
#define ASD_H

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

#endif // ASD_H


file asd.cpp

#include "asd.h"

asd::asd()
{
    //ctor
}

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


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

#include "asd.h"

int main(void)
{
    return 0;
}


why i'm getting this error!? thank you all in advance!

stahta01

#1
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.
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]

ehguacho


Greatwolf

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?

ehguacho

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... :(

oBFusCATed

(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

ehguacho

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!