VC ++。NET [英] VC++.NET

查看:98
本文介绍了VC ++。NET的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我试图将我的OpenGL / C ++ / SDL项目移植到VC ++ .NET。

为什么我会收到这些错误。代码在Linux下编译而没有

问题。我相信已经正确设置

include和lib dirs也是标题。

这些错误根本没有任何意义。

谢谢并且问候

Michael


警告C4067:预处理器指令后的意外令牌 -

预计换行符

致命错误C1070:文件''中的#if /#endif对不匹配:'\\\\\\\\\\\\\\\\\\\\\\\\\\指令 -

预计换行符

致命错误C1070:文件''中的#if /#endif对不匹配:'f:\\\\\\\\\\\\\\\\\\\ '

错误C2144:语法错误:''void''前面应加'';''


后跟gl.h中的千个错误

解决方案

2005年10月27日星期四08:31:45 +0200,Michael Sgier< sg *** @ nospam.ch>

写道:


我试图将我的OpenGL / C ++ / SDL项目移植到VC ++ .NET。
为什么我会得到这些错误。代码在Linux下编译,没有问题。我相信已经正确设置了include和lib dirs以及标题。
这些错误根本没有任何意义。
感谢和问候
Michael
<警告C4067:预处理器指令后面的意外令牌 -
预期换行符
致命错误C1070:文件'f:\\\\\\\\\\\\\\\\\\\\\\\\\\\\\警告C4067:预处理器指令后面的意外令牌 -
预期换行符
致命错误C1070:文件中的#if /#endif对不匹配f:\ aura\src\world.h''
错误C2144:语法错误:''void''前面应加'';''

后跟gl中的千个错误。 h




您正在使用类似的东西:

#if定义(某物)

#endif定义(某物) )


你*必须*改为:


#if定义(某事)

#endif / / defined(something)


Michael Sgier写道:


我试图将我的OpenGL / C ++ / SDL项目移植到VC ++ .NET。
为什么我会得到这些错误。代码在Linux下编译,没有问题。我相信已经正确设置了include和lib dirs以及标题。
这些错误根本没有任何意义。
感谢和问候
Michael
<警告C4067:预处理器指令后面的意外令牌 -
预期换行符
致命错误C1070:文件'f:\\\\\\\\\\\\\\\\\\\\\\\\\\\\\警告C4067:预处理器指令后面的意外令牌 -
预期换行符
致命错误C1070:文件中的#if /#endif对不匹配f:\ aura\src\world.h''
错误C2144:语法错误:''void''前面应加'';''

后跟gl中的千个错误。 h




如果你引用导致错误的行,这显然会有所帮助。

难道这么难吗?通常我们会看到没有错误消息的代码,

你已经反过来做了它。


我猜你有错误在

预处理指令中提到的文件,但没有看到文件很难

推测可能是什么。


john


你好约翰

'这整个文件没有任何内容。我检查了所有文件为world.h

是最后一个头文件,但我仍然找不到任何东西。另外我试过

来打开和关闭预先编辑//预编译的头文件......没有效果。我将
复制到另一个工作的Ogl程序(没有SDL)和

得到完全相同的错误....

谢谢

Michael

#ifndef __WORLD_H

#define __WORLD_H


// #include< dmusicc.h> ; // DirectMusic包括


// #include< dmusici.h>


// #include< d3d8types.h> //对于D3DVECTOR


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


#include< typeinfo> //对于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;



受保护:


void OnAnimate(浮点deltaTime);


void OnDraw(CCamera *相机, CTexture * tex);


void OnPrepare();


public:


// HWND hwnd;


CTerrain * terrain; //地形


CCamera *相机; //相机


CPlayer *播放器;

// CPlayer * OnGetPlayer(){返回播放器; }

//播放器


// CAudioSystem * audioSystem; //音频系统


// CAudio * worldSound; //世界环境声音


CGUI * gui;


COgroEnemy * ogroEnemy; // ogro敌人


CSodEnemy * sodEnemy; // sod the enemy


float timeStart;


float timeElapsed;


CWorld();


CWorld(CCamera * c);


~CWorld();


//初始化地形,加载对象并放入容器


void LoadWorld();


void UnloadWorld();

// int CountObjectTypes(const type_info& classID);


//对世界上所有物体进行物理计算


//包括碰撞


// void Animate(浮点deltaTime,CCamera *相机,CPlayer *播放器);


void Animate( float deltaTime);


//渲染世界上的所有物体


无法绘制(CCamera *相机);


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


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

解决方案

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)


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


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


这篇关于VC ++。NET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆