简体   繁体   English

调用父母的方法

[英]Calling parent's method

I'm kinda newbie to all this c++ stuff, so this probably is a beginner's problem: 我是所有这些C ++的新手,所以这可能是初学者的问题:

ListScreen.h ListScreen.h

#ifndef _LISTSCREEN_H_
#define _LISTSCREEN_H_

#include "MAUI/Screen.h"

namespace CoolPlaces {
    namespace Views {
        using namespace MAUI;

        class ListScreen : public Screen {
            public:
                ListScreen();
                ~ListScreen();

                void keyPressEvent(int keyCode, int nativeCode) {}
                void keyReleaseEvent(int keyCode, int nativeCode) {}
                void pointerPressEvent(MAPoint2d point) {}
                void pointerReleaseEvent(MAPoint2d point) {}
                void pointerMoveEvent(MAPoint2d point) {}
                void show();
        };
    }
}

#endif    //_LISTSCREEN_H_

ListScreen.cpp ListScreen.cpp

  #include "MAUI/Screen.h"
#include "ListScreen.h"

using namespace MAUI;
using namespace CoolPlaces::Views;

void ListScreen::show() {
    Screen::show();
};

I'm getting this error: D:\\MosyncProjects\\Views\\ListScreen.cpp:22: Error: Unresolved symbol '__ZN4MAUI6Screen4showEv' line 22 in this Screen::show(); 我收到此错误: D:\\MosyncProjects\\Views\\ListScreen.cpp:22: Error: Unresolved symbol '__ZN4MAUI6Screen4showEv' line 22Screen::show(); D:\\MosyncProjects\\Views\\ListScreen.cpp:22: Error: Unresolved symbol '__ZN4MAUI6Screen4showEv' line 22 Screen::show(); call (for purpose of this topic I removed some code). 调用(出于本主题的目的,我删除了一些代码)。 So what exactly am I doing wrong here? 那我到底在做什么错?

You're including the header file, which tells that the function Screen::show() exists, but probably not linking the library, which has the implementation. 您将包括头文件,该头文件告诉函数Screen::show()存在,但可能不链接具有实现的库。

See this page: http://www.mosync.com/docs/sdk/cpp/guides/libs/working-with-mosync-libraries/index.html 看到此页面: http : //www.mosync.com/docs/sdk/cpp/guides/libs/working-with-mosync-libraries/index.html

Specifically: 特别:

As well as referencing the header files in your application code, you also need to specify the actual libraries that you want to use in the project's Build Settings (Project > Properties > MoSync Project > Build Settings): 除了在应用程序代码中引用头文件之外,还需要指定要在项目的“构建设置”中使用的实际库(“项目”>“属性”> MoSync项目>“构建设置”):

It looks like maui.lib should contain the screen code. 看起来maui.lib应该包含屏幕代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM