ok I'm confused...

my class is empty, apart from an inclusion file, but has alot of errors that i cant understand.... Here's the .h file:

#ifndef creator 
#define creator

#include "stdafx.h"

class creator
{
	
public:

	creator();
       ~creator();
}


#endif

And here's the cpp file:

#include "creator.h"

creator::creator()
{ 
	
}

creator::~creator()
{
}

seeing as how there's nothing in it, why isnt it working?

There are more errors, like thinking '::' in my cpp file is a syntax error, or thinking that the '()' on the end of: creator::~creator() is "an illegal token on right side..."


Can anyone help me?

This is on visual studio 2008 express.

Recommended Answers

All 7 Replies

ok I'm confused...

my class is empty, apart from an inclusion file, but has alot of errors that i cant understand.... Here's the .h file:

#ifndef creator 
#define creator

#include "stdafx.h"

class creator
{
	
public:

	creator();
       ~creator();
}   //<------------ syntax error: a semi-colon is required here.


#endif

<snip>

seeing as how there's nothing in it, why isnt it working?

There are more errors, like thinking '::' in my cpp file is a syntax error, or thinking that the '()' on the end of: creator::~creator() is "an illegal token on right side..."


Can anyone help me?

This is on visual studio 2008 express.

You need to pay attention to your semi-colon use. See the in-code comment I added. The particular semi-colon you missed is a huge one. If that one is missing the compiler will get VERY confused.

commented: Easy catch :) +20

What that dude said!

You need to pay attention to your semi-colon use. See the in-code comment I added. The particular semi-colon you missed is a huge one. If that one is missing the compiler will get VERY confused.

ah thanks! i didnt notice that.

one down at least!

all the errors from before are there, minus 1.

12 errors in total.... still cant believe i missed something so basic...

What is the first error that returns? Focus on fixing that one, then once you have, others may disappear along with it. It is not unusual for one error to cause others farther down by confusing the compiler.

If you don't know how to fix it, post the error and the section(s) of code that it flags and we'll see if we can help.

What is the first error that returns? Focus on fixing that one, then once you have, others may disappear along with it. It is not unusual for one error to cause others farther down by confusing the compiler.

If you don't know how to fix it, post the error and the section(s) of code that it flags and we'll see if we can help.

1>c:\users\~chaqz\documents\visual studio 2008\projects\dragonslayer\dragonslayer\creator.h(12) : error C2059: syntax error : '('

this is pointing to the destructor in the header file...

hey i found what was wrong. it was my definitions at the start of the file:

#ifndef creator 
#define creator 

//some code here, a class there... 

#endif

I'm not sure how, but changing to this more popular format made it all go away:

#ifndef __CREATOR_H_
#define __CREATOR_H_

//code here... 

#endif

thanks for the help!

It would probably have to do with the fact that your class is also called "creator".

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.