Author Topic: Classes implementation?  (Read 7538 times)

Offline ehguacho

  • Single posting newcomer
  • *
  • Posts: 4
Classes implementation?
« 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!

Online stahta01

  • Lives here!
  • ****
  • Posts: 7787
    • My Best Post
Re: Classes implementation?
« Reply #1 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.
« Last Edit: December 14, 2010, 08:04:16 pm 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 ehguacho

  • Single posting newcomer
  • *
  • Posts: 4
Re: Classes implementation?
« Reply #2 on: December 15, 2010, 05:34:37 am »
GNU GCC Compiler

Offline Greatwolf

  • Multiple posting newcomer
  • *
  • Posts: 48
Re: Classes implementation?
« Reply #3 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?

Offline ehguacho

  • Single posting newcomer
  • *
  • Posts: 4
Re: Classes implementation?
« Reply #4 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... :(

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: Classes implementation?
« Reply #5 on: December 15, 2010, 06:13:31 pm »
(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!]

Offline ehguacho

  • Single posting newcomer
  • *
  • Posts: 4
Re: Classes implementation?
« Reply #6 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!