Page 1 of 1

Error in class declaration

Posted: Fri Dec 18, 2009 3:58 pm
by zangai
I am currently working on a application for the Nintendo DS. I got this header file:

line.h

Code: Select all

class CLine
{
public:

	int pos;
	bool vert;
	int speed;
	unsigned short color;

	CLine(void);
	~CLine(void);
	void draw();
	void clear();
};
But when compiling it, I get the following error:

Code: Select all

Line.h(1): error: expected '=', ',', ';', 'asm' or '__attribute__' before 'CLine'
Is this because normal class declaration is not supported on DevKitARM? Or what am I doing wrong?

Thanks in advance.

Re: Error in class declaration

Posted: Fri Dec 18, 2009 4:23 pm
by Izhido
Be sure your .cpp files have a .cpp extension, instead of .c . The standard makefile(s) of the toolchain decide which compiler (C or C++) to use based on the extension of the files you're giving to it.

Re: Error in class declaration

Posted: Fri Dec 18, 2009 5:20 pm
by zangai
I changed the main.c to main.cpp, cleaned my project, rebuild it, and it worked!

Thank you :)