473,473 Members | 1,782 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

VC++.NET

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:\aura\src\world.h'

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

followed by thousand errors in gl.h
Oct 27 '05 #1
11 12454
On Thu, 27 Oct 2005 08:31:45 +0200, Michael Sgier <sg***@nospam.ch>
wrote:
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:\aura\src\world.h'

warning C4067: unexpected tokens following preprocessor directive -
expected a newline
fatal error C1070: mismatched #if/#endif pair in file 'f:\aura\src\world.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)
Oct 27 '05 #2
Michael Sgier wrote:
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:\aura\src\world.h'

warning C4067: unexpected tokens following preprocessor directive -
expected a newline
fatal error C1070: mismatched #if/#endif pair in file 'f:\aura\src\world.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
Oct 27 '05 #3
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
Oct 27 '05 #4
Ian
Michael Sgier wrote:
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
Oct 27 '05 #5
Nope that doesn't help. Still the same errors.
Oct 27 '05 #6
Michael Sgier wrote:
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.

Oct 27 '05 #7
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
Oct 27 '05 #8
Michael Sgier wrote:
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


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
Oct 27 '05 #9
Ian
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
Oct 27 '05 #10
Ian wrote:
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
Oct 28 '05 #11
Ian
John Harrison wrote:
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
Oct 29 '05 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Tatu Portin | last post by:
Have this kind of struct: typedef struct { char **user_comments; /* ... */ } vorbis_comment; /* prototype */ char * read_vorbis_string ( FILE *sc);
4
by: Anthony Gallagher | last post by:
I have a bunch of libraries compiled using VC++ 6.0, and I am trying to recompile one of our projects using VC++ .NET. I get all kind of linker errors (specially in STL calls). How do I get rid of...
5
by: Hari | last post by:
Guys please help me to solve this strange problem what Iam getting as follows.. Trying to instantiate a global instance of a template class as follows :- when i build this code with debug and...
2
by: vemulakiran | last post by:
Hi all, I have doubt regarding .NET. I have a tool which was developed on VC++ 6.0(Win32 Application ). The application communicates with library (API) which was developed on VC++ 6.0 called core...
2
by: | last post by:
Everything seems to be moving to .NET and VC++ seems to be adding a lot of managed code support every new release. The questions: is unmanaged code in VC++ beeing phased out in favour of managed...
4
by: ultranet | last post by:
I have cruised around http://msdn.microsoft.com/visualc/ and the rest of the site, and i am not able to find a single C++ or VC++ certification exam that will be available after June 30, 2004. I...
1
by: Steve | last post by:
We are considering the ways to migrate our VC++ 6.0 applications to .NET platform. It would be nice to rewrite them completely in C#, but due to the time constraints this option is out of...
2
by: um | last post by:
When the POSIX pthreads library for w32 release 2-2-0 (http://sources.redhat.com/pthreads-win32/) is compiled with VC++6 then it compiles and passes all the benchmark tests in the subdirectory...
15
by: Michael Tissington | last post by:
I have a Visual Basic 6.0 ActiveX Control. It seems there is no way with VS 2005 to create a similar control for containers that host ActiverX controls, is this correct ? I'm thinking of...
7
by: Norman Diamond | last post by:
A project depends on VC runtime from Visual Studio 2005 SP1, and DotNet Framework 2. Options are set in the setup project properties, so if these two dependencies are not already installed then...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.