问题描述
你好
在main.cpp中:
CWorld * gameWorld =新的CWorld; //我需要这个吗?
CSimpEngine * MyCSimpEngine =新的CSimpEngine;
CWorld * world = MyCSimpEngine-> OnGetWorld();
world-> Prepare(); //这里我得到以下错误
in simpengine.h:
class CSimpEngine //:public CEngine
{
私人:
CWorld * gameWorld;
public:
CWorld * OnGetWorld(){return gameWorld; }
}
在world.cpp中:
CWorld :: CWorld()
{
CTerrain * terrain =新CTerrain(256,0.5);
}
world.cpp:59:错误:`terrain''未声明(首先使用此功能)
为什么我会收到错误?在我理解OnGetWorld后初始化
CWorld哪个构造函数初始化地形?我错了吗?我需要
第一行main.cpp吗?
感谢和来自瑞士的问候
Michael
- -
我应该成为像我的邻居费德勒一样的网球No.1 ......好吧现在它已经太晚了: - /
Hello
In main.cpp:
CWorld* gameWorld = new CWorld; // do i need this?
CSimpEngine* MyCSimpEngine = new CSimpEngine;
CWorld *world = MyCSimpEngine->OnGetWorld();
world->Prepare(); //here i get the error below
in simpengine.h:
class CSimpEngine //: public CEngine
{
private:
CWorld *gameWorld;
public:
CWorld *OnGetWorld() { return gameWorld; }
}
in world.cpp:
CWorld::CWorld()
{
CTerrain* terrain = new CTerrain(256, 0.5);
}
world.cpp:59: error: ` terrain'' undeclared (first use this function)
Why do i get the error? After my understanding OnGetWorld initializes
CWorld which constructor initializes terrain? Am i wrong? Do i need the
first line of main.cpp?
THANKS and regards from Switzerland
Michael
---
I should have become a Tennis No.1 like my neighbor Federer...well now it''s
too late :-/
推荐答案
我不知道。你想用它做什么?
V
I don''t know. What are you trying to accomplish with it?
V
取决于你希望你的程序做什么。
-Mike
Depends upon what you want your program to do.
-Mike
我很害怕你又做了同样的事情。当你有编译器
错误时,请发布* ALL *代码。回答
您在所发布的代码中提出的任何一个问题都是不可能的。
您对OnGetWorld的理解不正确,但无论如何都是无关紧要的
,因为这是一个编译器错误。
完全猜测我会说你的问题是因为没有
包括正确的头文件,但当然我不能告诉因为
你没有发布所有代码。
请你,你已经发了好几次对于这个小组,你问好b / b
问题,但如果你想要问题,请在所有代码后回答。
john
I''m afraid you are doing the same thing again. When you have compiler
error please post *ALL* the code. It is quite impossible to answer
either of the questions you asked on the code you have posted.
Your understanding about OnGetWorld is incorrect, but irrelevent anyway
because this is a compiler error.
Taking a complete guess I would say the your problem is because of not
including the correct header files, but of course I cannot tell BECAUSE
YOU DIDN''T POST ALL THE CODE.
Please, you''ve posted several times to this group, you ask good
questions but if you want you questions answered post all the code.
john
这篇关于裁判的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!