Page 1 of 1

Strange C++ problem

Posted: Tue Mar 23, 2004 3:28 pm
by Cleves
Hey all,

I was doing a regular programming,I tried to compile and he pointed to a problem in one of my headers files.I looked for hour trying to figure what's the problem, but I couldn't find it.

Code: Select all

#ifndef __HARVESTER_H_INCLUDED__
#define __HARVESTER_H_INCLUDED__
						
#include "irrlicht.h"
#include "Cmain.h"

ISceneNode* harvesternode = 0;
IAnimatedMesh* harvester = 0;

void loadharvester()
{
	 harvester = smgr->getMesh("Data/hunter.3ds");
	 harvesternode = smgr->addAnimatedMeshSceneNode(harvester);	
    
    if (harvesternode)
	{
	harvesternode->setMaterialFlag(EMF_LIGHTING, false);
    harvesternode->setPosition(vector3df(24100,798,-8205));
   	}  
};
 
#endif
Here is the error:
c:\program files\irrlicht\the scout\harvester.h(7) : error C2146: syntax error : missing ';' before identifier 'ISceneNode'
c:\program files\irrlicht\the scout\harvester.h(7) : fatal error C1004: unexpected end of file found

Why do I need to put ";"? :?

Thanks

Posted: Tue Mar 23, 2004 3:38 pm
by HeWhoAsksAQuestion
Check your CMain.h, C++ compilers will think your cpp has errors because a bad header is included.

Posted: Tue Mar 23, 2004 3:52 pm
by Tyn
Might help to do a:

Code: Select all

using namespace irr;
because even tho it may be defined in another header file it sometimes doesn't recognise it ( at least in my apps ) and comes up with strange compile error's. Tho it probably is somewhere in CMain.h where you have missed a ;

Posted: Tue Mar 23, 2004 4:16 pm
by jugurdzija
maybe you forgot this

class CMain
{

code

}; <----

Posted: Wed Mar 24, 2004 4:29 am
by Cleves
I checked all you have told, found nothing wrong.
Here is my Cmain code, maybe you will find something:

Code: Select all

#ifndef __VARIABLES_H_INCLUDED__
#define __VARIABLES_H_INCLUDED__

#include <irrlicht.h>
#include <wchar.h>
#include <iostream>
#include <conio.h>
#include <stdlib.h>
#include <stdio.h>
#include <fstream.h>
#include <hejka.h>
#include <harvester.h>
		
						
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;

const wchar_t edit[2]=L"/";
const wchar_t inputedit=0; 
const int key=0; 
bool consoleon = false;
int fps;

IVideoDriver* driver;
ISceneManager* smgr;
IGUIEnvironment* guienv;
ICameraSceneNode* camera = 0;
IrrlichtDevice *dvc;
ISceneNode* skyboxnode=0;
IGUIWindow* console=0;
IGUIEditBox* consoleedit=0;
position2d<s32> mouseconsole(0,0);
s32 id;
ISceneNode* uk7node = 0;
IAnimatedMesh* uk7 = 0;
ISceneNode* firebirdnode = 0;
IAnimatedMesh* firebird = 0;

IGUIImage* mainm=0;
IGUIImage* newgamebutton=0;
IGUIImage* optionsbutton=0;
IGUIImage* missionsbutton=0;
IGUIImage* creditsbutton=0;
IGUIImage* quitbutton=0;

#endif

Posted: Wed Mar 24, 2004 2:48 pm
by kakTuZ
Hi, there is one thing I allways try to avoid im my code: You include CMain.h in harvester.h und harvester.h in CMain.h. But that should not be the problem.
But perhaps the error is in hejka.h and your compiles doesn't get it to point give you an error in that file
hmm, I am just guessing, cos no one answers

Posted: Wed Mar 24, 2004 2:54 pm
by Tyn
To start with, I will say I don't have a clue why it doesn't work. One thing I try is commenting out bits of code to isolate the problem, sometimes works.

Posted: Wed Mar 24, 2004 3:29 pm
by Cleves
Ok, I found the problem.
Thanks a lot guys :D