我正在努力完成我的学校项目。我在使用代码块时在c中编写基于文本的冒险游戏。我开始作为控制台应用程序,相当不错,我很满意。但是项目必须包含在WxWidgets中创建的GUI,所以我只想在我的控制台应用程序中添加一个GUI,这里问题就出现了。我正在与WxWidgets中的私有和公共对象进行斗争,我仍然得到这个错误C:\Users\Petr2\Desktop\Programko\TextovkaWxW\inventar.cpp|12|undefined reference to WxWFrame::TextCtrl1'|
这个错误。
我试图将我的所有函数定义到公共部分WxWidgets。
public:
WxWFrame(wxWindow* parent,wxWindowID id = -1);
virtual ~WxWFrame();
wxString vstup;
static wxString vystup;
static int getInput();
static char input[100];
static int parseAndExecute();
static void moveObject(const char *noun, OBJECT *from, OBJECT *to);
static void executeLook(const char *noun);
static void executeGo(const char *noun);
static void executeGet(const char *noun);
static void executeDrop(const char *noun);
static void executeGive(const char *noun);
static void executeAsk(const char *noun);
static void executeInventory(void);
static int nounIsInTags(const char *noun, const char **tags);
static int listObjectsAtLocation(OBJECT *location);
这是函数,我得到错误,它在另一个.cpp文件
void WxWFrame::moveObject(const char *noun, OBJECT *from, OBJECT *to)
{
OBJECT *obj = parseObject(noun);
if (obj == NULL)
{
TextCtrl1->AppendText("I don't understand what item you mean.\n");
}
而我真的不知道,我应该如何定义自己的变量" vystup"或使用TextCtrl1-> AppendText通过()
我将感谢每一个答案,我将从我的代码中添加您想要的任何内容或回答任何问题。我只是...不知道,我试图寻找可行的答案,但没有什么能真正帮助我。那就是为什么我在这里写。 谢谢
PS:对不起我的英文不好