我试图移植在linux/g ++中开发的程序/游戏,以便它在Windows 7 VS 2008 C++上运行。该程序使用诸如OpenGL,SDL和Boost等库。VS 2008 C++错误C2059和C2238
我已经解决了很多错误,但我有点卡在这一个。
我得到错误代码C2059和C2238。实际的错误信息是:
------ Build started: Project: Asteroid Blaster, Configuration: Release Win32 ------
Compiling...
WeaponDisplay.cpp
Weapon.cpp
ViewFrustum.cpp
Vector3D.cpp
UDP_Server.cpp
d:\College\AsteroidBlaster\Utility/ViewFrustum.h(40) : error C2059: syntax error : ';'
d:\College\AsteroidBlaster\Utility/ViewFrustum.h(40) : error C2238: unexpected token(s) preceding ';'
d:\College\AsteroidBlaster\Utility/ViewFrustum.h(41) : error C2059: syntax error : ';'
d:\College\AsteroidBlaster\Utility/ViewFrustum.h(41) : error C2238: unexpected token(s) preceding ';'
UDP_Client.cpp
d:\College\AsteroidBlaster\Utility/ViewFrustum.h(40) : error C2059: syntax error : ';'
d:\College\AsteroidBlaster\Utility/ViewFrustum.h(40) : error C2238: unexpected token(s) preceding ';'
d:\College\AsteroidBlaster\Utility/ViewFrustum.h(41) : error C2059: syntax error : ';'
d:\College\AsteroidBlaster\Utility/ViewFrustum.h(41) : error C2238: unexpected token(s) preceding ';'
TractorBeamShot.cpp
的ViewFrustum.h文件如下:
/**
* viewFrustum: It's got useful functions to cull items that aren't in your view frustum
*
* 2-7-11
* CPE ---
*/
#ifndef __VIEW_FRUSTUM_H__
#define __VIEW_FRUSTUM_H__
#include "Items/Object3D.h"
#include "Utility/Plane.h"
#include "Utility/Matrix4.h"
#include <vector>
#include <set>
class ViewFrustum {
public:
ViewFrustum();
virtual ~ViewFrustum();
/* Takes in a list of all the Object 3D's around, and culls them down to only the ones
* that are inside the view frustum.
*/
virtual std::list<Drawable*>* cullToViewFrustum(std::vector<Drawable*>* all, bool skipParticles);
virtual std::list<Object3D*>* cullToViewFrustum(std::vector<Object3D*>* all);
/* Prints out details about all of the planes of the view frustum.
*/
virtual void print();
private:
Matrix4 projMatrix;
Matrix4 modelViewMatrix;
Plane* top;
Plane* bottom;
Plane* left;
Plane* right;
Plane* near;
Plane* far;
/**
* A modified version of chedDrawableOutside, used by the AI. This stops the
* AI from targeting Drawable objects which are slightly outside the field
* of view, which still need to be drawn.
*/
bool checkTargetableOutside(Drawable* obj);
/* Returns true if the Drawable object is completely outside of the
* view frustum planes.
* Returns false if it's even part-way inside.
*/
virtual bool checkDrawableOutside(Drawable* obj);
};
#endif
违规的线(40-41)是:
Plane* near;
Plane* far;
这是一种令人困惑因为ViewFrustum obj已经编译好了,但是当它到达UDP_Server.cpp和UDP_Client.cpp时,它会抛出一个错误。我不确定它是否重要,但UDP类使用Boost的异步和序列化模块。我知道Boost有时会发出奇怪的警告,但我不确定Boost是否必须对此错误执行任何操作。
如果有人有任何想法,为什么这是或如果你需要更多的代码张贴,请让我知道。
将变量名更改为* Plane(即 - nearPlane)修正了此错误。谢谢! – 2011-05-22 06:53:15