C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

VC++.NET

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++)
View previous topic :: View next topic  
Author Message
Michael Sgier
Guest





PostPosted: Thu Oct 27, 2005 6:31 am    Post subject: VC++.NET Reply with quote



Hi
i trying to port my OpenGL / C++ / SDL project to VC++.NET.
Why do i get those errors. The code compiles under Linux without
problems. I beliebe to have set correctly
the include and lib dirs also the headers.
Those errors do NOT make any sense at all.
THANKS and regards
Michael

warning C4067: unexpected tokens following preprocessor directive -
expected a newline
fatal error C1070: mismatched #if/#endif pair in file 'f:aurasrcworld.h'

warning C4067: unexpected tokens following preprocessor directive -
expected a newline
fatal error C1070: mismatched #if/#endif pair in file 'f:aurasrcworld.h'
error C2144: syntax error : 'void' should be preceded by ';'

followed by thousand errors in gl.h
Back to top
Zara
Guest





PostPosted: Thu Oct 27, 2005 7:11 am    Post subject: Re: VC++.NET Reply with quote



On Thu, 27 Oct 2005 08:31:45 +0200, Michael Sgier <sgier (AT) nospam (DOT) ch>
wrote:

Quote:
Hi
i trying to port my OpenGL / C++ / SDL project to VC++.NET.
Why do i get those errors. The code compiles under Linux without
problems. I beliebe to have set correctly
the include and lib dirs also the headers.
Those errors do NOT make any sense at all.
THANKS and regards
Michael

warning C4067: unexpected tokens following preprocessor directive -
expected a newline
fatal error C1070: mismatched #if/#endif pair in file 'f:aurasrcworld.h'

warning C4067: unexpected tokens following preprocessor directive -
expected a newline
fatal error C1070: mismatched #if/#endif pair in file 'f:aurasrcworld.h'
error C2144: syntax error : 'void' should be preceded by ';'

followed by thousand errors in gl.h

You are using something like:
#if defined(something)
#endif defined(something)

You *must* change that to:

#if defined(something)
#endif // defined(something)



Back to top
John Harrison
Guest





PostPosted: Thu Oct 27, 2005 7:11 am    Post subject: Re: VC++.NET Reply with quote



Michael Sgier wrote:
Quote:
Hi
i trying to port my OpenGL / C++ / SDL project to VC++.NET.
Why do i get those errors. The code compiles under Linux without
problems. I beliebe to have set correctly
the include and lib dirs also the headers.
Those errors do NOT make any sense at all.
THANKS and regards
Michael

warning C4067: unexpected tokens following preprocessor directive -
expected a newline
fatal error C1070: mismatched #if/#endif pair in file 'f:aurasrcworld.h'

warning C4067: unexpected tokens following preprocessor directive -
expected a newline
fatal error C1070: mismatched #if/#endif pair in file 'f:aurasrcworld.h'
error C2144: syntax error : 'void' should be preceded by ';'

followed by thousand errors in gl.h

It would obviously help if you quoted the lines which cause the errors.
Is this so hard to do? Normally we see code without the error messages,
you've manged to do it the other way round.

I would guess that you have an error in the preprocessing directives in
the file mentioned, but without seeing the file it is difficult to
speculate what that might be.

john

Back to top
Michael Sgier
Guest





PostPosted: Thu Oct 27, 2005 8:13 am    Post subject: Re: VC++.NET Reply with quote

Hello John
that's the whole file nothing cut out. I checked all files as world.h
is the last header file but still i couldn't find anything. Also i tried
to switch precomiling//precompiled headers on and off...no effect. I
copied those files to another working Ogl program ( without SDL ) and
got exactly the same errors....
THANKS
Michael


#ifndef __WORLD_H
#define __WORLD_H



//#include <dmusicc.h> // DirectMusic includes

//#include <dmusici.h>

//#include <d3d8types.h> // for D3DVECTOR

//#include <cguid.h> // for GUID_NULL

#include <typeinfo> // for RTTI



#include "gui.h"

#include "player.h"

#include "sod.h"

#include "ogro.h"

#include "entity.h"

#include "Md3.h"
#include "md2.h"
#include "object.h"

#include "camera.h"

#include "terrain.h"

//#include "audiosystem.h"

#include "tree.h"



#define MAX_ENEMIES 10



class CWorld

{

private:

int numOgros, numSods;

int screenWidth, screenHeight;

bool gameDone;




protected:

void OnAnimate(float deltaTime);

void OnDraw(CCamera *camera, CTexture *tex);

void OnPrepare();



public:

//HWND hwnd;



CTerrain *terrain; // the terrain

CCamera *camera; // the camera

CPlayer *player;
//CPlayer *OnGetPlayer() { return player; }
// the player

//CAudioSystem *audioSystem; // the audio system

//CAudio *worldSound; // the world ambient sound

CGUI *gui;



COgroEnemy *ogroEnemy; // ogro enemies

CSodEnemy *sodEnemy; // sod enemies



float timeStart;

float timeElapsed;



CWorld();

CWorld(CCamera *c);

~CWorld();



// initialize terrain, load objects and put in container

void LoadWorld();

void UnloadWorld();



// int CountObjectTypes(const type_info &classID);



// do physics calculations for all objects in the world

// including collisions

// void Animate(float deltaTime, CCamera* camera, CPlayer* player);

void Animate(float deltaTime);

// render all objects in the world

void Draw(CCamera *camera);

void Prepare() { OnPrepare(); }
int DrawCube();


void FadeScreen();

void SetScreen(int width, int height);



bool IsGameDone() { return gameDone; }

void QuitGame() { gameDone = true; }

int GetOgros() { return numOgros; }

int GetSods() { return numSods; }

};





#endif
Back to top
Ian
Guest





PostPosted: Thu Oct 27, 2005 8:38 am    Post subject: Re: VC++.NET Reply with quote

Michael Sgier wrote:
Quote:
Hello John
that's the whole file nothing cut out. I checked all files as world.h
is the last header file but still i couldn't find anything. Also i tried
to switch precomiling//precompiled headers on and off...no effect. I
copied those files to another working Ogl program ( without SDL ) and
got exactly the same errors....
THANKS
Michael


#ifndef __WORLD_H

Avoid double underscores.

Ian



Back to top
Michael Sgier
Guest





PostPosted: Thu Oct 27, 2005 9:33 am    Post subject: Re: VC++.NET Reply with quote

Nope that doesn't help. Still the same errors.
Back to top
paulius-maruska
Guest





PostPosted: Thu Oct 27, 2005 10:00 am    Post subject: Re: VC++.NET Reply with quote

Michael Sgier wrote:
Quote:
Nope that doesn't help. Still the same errors.
Not that long ago, i had some problems with preprocessor too. In my

case, what solved the problem is the newline after header-guard #endif.

Other than that, there could be problems in the other files that you
include (VC doesn't always report the right filename), so you might
want to check them too.


Back to top
Michael Sgier
Guest





PostPosted: Thu Oct 27, 2005 6:26 pm    Post subject: Re: VC++.NET Reply with quote

Hello
Nope no help so far...It must be some sort of alignment. I tried devCPP
and thatone only stops at several #include xxx without any details to
the errors. Really strange and timeconsuming aargh.
THANKS for further tips.
Michael
Back to top
John Harrison
Guest





PostPosted: Thu Oct 27, 2005 6:46 pm    Post subject: Re: VC++.NET Reply with quote

Michael Sgier wrote:
Quote:
Hello John
that's the whole file nothing cut out. I checked all files as world.h
is the last header file but still i couldn't find anything. Also i tried
to switch precomiling//precompiled headers on and off...no effect. I
copied those files to another working Ogl program ( without SDL ) and
got exactly the same errors....
THANKS
Michael


#ifndef __WORLD_H
#define __WORLD_H



//#include <dmusicc.h> // DirectMusic includes

//#include <dmusici.h

//#include
//#include <cguid.h> // for GUID_NULL

#include <typeinfo> // for RTTI



#include "gui.h"

#include "player.h"

#include "sod.h"

#include "ogro.h"

#include "entity.h"

#include "Md3.h"
#include "md2.h"
#include "object.h"

#include "camera.h"

#include "terrain.h"

//#include "audiosystem.h"

#include "tree.h"



#define MAX_ENEMIES 10



class CWorld

{

private:

int numOgros, numSods;

int screenWidth, screenHeight;

bool gameDone;




protected:

void OnAnimate(float deltaTime);

void OnDraw(CCamera *camera, CTexture *tex);

void OnPrepare();



public:

//HWND hwnd;



CTerrain *terrain; // the terrain

CCamera *camera; // the camera

CPlayer *player;
//CPlayer *OnGetPlayer() { return player; }
// the player

//CAudioSystem *audioSystem; // the audio system

//CAudio *worldSound; // the world ambient sound

CGUI *gui;



COgroEnemy *ogroEnemy; // ogro enemies

CSodEnemy *sodEnemy; // sod enemies



float timeStart;

float timeElapsed;



CWorld();

CWorld(CCamera *c);

~CWorld();



// initialize terrain, load objects and put in container

void LoadWorld();

void UnloadWorld();



// int CountObjectTypes(const type_info &classID);



// do physics calculations for all objects in the world

// including collisions

// void Animate(float deltaTime, CCamera* camera, CPlayer* player);

void Animate(float deltaTime);

// render all objects in the world

void Draw(CCamera *camera);

void Prepare() { OnPrepare(); }
int DrawCube();


void FadeScreen();

void SetScreen(int width, int height);



bool IsGameDone() { return gameDone; }

void QuitGame() { gameDone = true; }

int GetOgros() { return numOgros; }

int GetSods() { return numSods; }

};





#endif

This is a strange error. Notice there are no #if/#endif pairs in that file.

I would try removing code until the error goes away. Last bit of code
removed will be the one causing the error. Start with the CWorld class
and then try each of the #includes in turn. If removing an #include
solves the problem then it's probably something in that header.

john

Back to top
Ian
Guest





PostPosted: Thu Oct 27, 2005 7:41 pm    Post subject: Re: VC++.NET Reply with quote

John Harrison wrote:
Quote:

This is a strange error. Notice there are no #if/#endif pairs in that file.

I would try removing code until the error goes away. Last bit of code
removed will be the one causing the error. Start with the CWorld class
and then try each of the #includes in turn. If removing an #include
solves the problem then it's probably something in that header.

Could be one of the other include files has a #if and no corresponding

#endif, so the compiler only spots the problem when it runs out of input
and still has an open #if.

Ian

Back to top
John Harrison
Guest





PostPosted: Fri Oct 28, 2005 9:48 pm    Post subject: Re: VC++.NET Reply with quote

Ian wrote:
Quote:
John Harrison wrote:


This is a strange error. Notice there are no #if/#endif pairs in that
file.

I would try removing code until the error goes away. Last bit of code
removed will be the one causing the error. Start with the CWorld class
and then try each of the #includes in turn. If removing an #include
solves the problem then it's probably something in that header.

Could be one of the other include files has a #if and no corresponding
#endif, so the compiler only spots the problem when it runs out of input
and still has an open #if.

Ian

IIRC C++ forbids unbalanced #if/#endif or #ifdef/#endif within a single
file. So an error like that could be caught before leaving the file with
the unbalanced directives.

john

Back to top
Ian
Guest





PostPosted: Sat Oct 29, 2005 1:06 am    Post subject: Re: VC++.NET Reply with quote

John Harrison wrote:
Quote:
Could be one of the other include files has a #if and no corresponding
#endif, so the compiler only spots the problem when it runs out of
input and still has an open #if.

Ian


IIRC C++ forbids unbalanced #if/#endif or #ifdef/#endif within a single
file. So an error like that could be caught before leaving the file with
the unbalanced directives.

Another perennial is a missing '}' at the end of a class or namespace.


Ian

Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.