# Ghost Code Block

This topic is 3684 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

hiyaz, im getting an error with the offedning code: line 14 "HE_Graphics graphicsPtr;"
Quote:
 error C2146: syntax error : missing ';' before identifier 'graphicsPtr'
Without the line of code it compiles fine. Here's what ive tried so far: 0.Moving the line of code later in the class (still causes error just differnt line number 1.replaceing the HE_Graphics with Other Classes. same error 2.Searched up and down formissing ";" in included classes 3.getting rid of the class all together, this causes a similar error in a different class 4.deleting *.ncb 5.reInstalling vc++ 6.Recreating all classes 7.Deleting similar or Duplicate classes Heres the code for the Class currently giving me the prob.
#pragma once
#include "stdafx.h"
#include "HE_Object.h" // dont really need this here, just so i know what im using

class HE_SceneGraph
{
public:

HE_SceneGraph(void);
~HE_SceneGraph(void);

HE_Graphics graphicsPtr; // <-------- OFFENDING LINE
HE_Object world;
std::vector<HE_Object*> list;

void remove(void);
void print(void);

};


vcpp 2008 compiler intel mac - Booting into XP sp1

##### Share on other sites
Sorry for not having a clue as the syntax looks fine to me, but I just have a question. What is this:
	HE_SceneGraph(void);	~HE_SceneGraph(void);

for? The only use I've ever seen of ~ before is as the bitwise operator. Maybe I am just misunderstanding the code's structure and setup.

##### Share on other sites
Have you checked the include files for missing ;'s?

@TacticalPenguin - The ~ means that it is a destructor for the class.

Edit - sorry, i just reread your post, and you already tried what I suggested. Sorry again.

##### Share on other sites
Did you include the header file that HE_Graphics is defined in? I only see #include "HE_Object.h"

##### Share on other sites
One of the headers has a huge list of other classes that the problem ";" could be in. I get a similar problem in another class if I leave out the sceneGraph class. So instead of manually searching through 20 different classes, that seem to compile fine on their own, is there another way to find a missing ";"??
Ive gone over HE_Graphics a million times already which tells me it's a different class.

##### Share on other sites
im assuming theres no headers being used within the class with this code, yet im getting the same errors:

#pragma once//#include "stdafx.h"//#include "HE_Object.h"//#include "HE_Graphics.h"//#include <vector>class HE_SceneGraph{public:		HE_SceneGraph(void);	~HE_SceneGraph(void);			HE_Graphics graphicsPtr;	//HE_Object world;		//std::vector<HE_Object*> list;			//void add(HE_Object &item);		void remove(void);		void print(void);			};

is it possible that the problem could be a different Class Calling HE_SceneGraph class???

[Edited by - dvak on November 17, 2008 1:57:33 AM]

##### Share on other sites
OK...Perhaps this means something more. Here is a new error with a basically blank class:

Quote:
 he_scenegraph.h(9) : error C2011: 'HE_SceneGraph' : 'class' type redefinition

//#pragma once//#include "stdafx.h"//#include "HE_Object.h"//#include "HE_Graphics.h"//#include <vector>class HE_SceneGraph{public:		HE_SceneGraph(void);	~HE_SceneGraph(void);			//HE_Graphics *graphicsPtr;	//HE_Object world;		//std::vector<HE_Object*> list;			//void add(HE_Object &item);		//void remove(void);		//void print(void);			};

As said before i've deleted the *.ncb file, and there is no similar class in my project folder. Any other ideas??

##### Share on other sites
Quote:
Original post by dvak
OK...Perhaps this means something more. Here is a new error with a basically blank class:

Quote:
 he_scenegraph.h(9) : error C2011: 'HE_SceneGraph' : 'class' type redefinition

*** Source Snippet Removed ***

As said before i've deleted the *.ncb file, and there is no similar class in my project folder. Any other ideas??

It looks here like you are including the file in multiple places. Uncommenting #pragma once should fix this.

It looks to me like the problem with the code in your original post is in the HE_Graphics class. This error when there is obviously a semi-colon usually means that the type of object you are trying to declare is not a valid type. Doing a forward declaration should fix the error.

This is a forward declaration:
class HE_Graphics;

A forward declaration won't make the actual declaration come up as an error when it gets to it; it just tells the compiler that you intend to define this class later on.

##### Share on other sites
the forward declaration worked! genious. THANK YOU!!
why is it that including the "Graphics" class in the header doesn't do the same thing.??

##### Share on other sites
Quote:
 Original post by dvakthe forward declaration worked! genious. THANK YOU!!why is it that including the "Graphics" class in the header doesn't do the same thing.??

It's impossible to tell without seeing all of your code, unfortunately. Also, I am not very familiar with the msvs compiler/linker, so I might not be able to tell you even if you showed me the code. I just recognize that particular error, as I have run into it myself many times before. When I first started C++, I never thought to come to one of these websites to ask questions, so I would spend many many hours figuring them out... but by golly, I never forgot the solutions ;)

1. 1
2. 2
Rutin
19
3. 3
khawk
18
4. 4
5. 5

• 9
• 12
• 16
• 26
• 10
• ### Forum Statistics

• Total Topics
633769
• Total Posts
3013759
×

## Important Information

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!