Strange C++ problem

Discuss about anything related to the Irrlicht Engine, or read announcements about any significant features or usage changes.
Post Reply
Cleves
Posts: 224
Joined: Mon Sep 08, 2003 6:40 pm

Strange C++ problem

Post 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
HeWhoAsksAQuestion

Post by HeWhoAsksAQuestion »

Check your CMain.h, C++ compilers will think your cpp has errors because a bad header is included.
Tyn
Posts: 932
Joined: Thu Nov 20, 2003 7:53 pm
Location: England
Contact:

Post 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 ;
jugurdzija
Posts: 26
Joined: Thu Feb 05, 2004 10:58 pm

Post by jugurdzija »

maybe you forgot this

class CMain
{

code

}; <----
Cleves
Posts: 224
Joined: Mon Sep 08, 2003 6:40 pm

Post 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
kakTuZ
Posts: 12
Joined: Sun Mar 14, 2004 7:28 pm
Location: Hannover (Germany)

Post 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
Tyn
Posts: 932
Joined: Thu Nov 20, 2003 7:53 pm
Location: England
Contact:

Post 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.
Cleves
Posts: 224
Joined: Mon Sep 08, 2003 6:40 pm

Post by Cleves »

Ok, I found the problem.
Thanks a lot guys :D
Post Reply