Search code examples
c++mosync

Calling parent's method


I'm kinda newbie to all this c++ stuff, so this probably is a beginner's problem:

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

  #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(); call (for purpose of this topic I removed some code). So what exactly am I doing wrong here?


Solution

  • You're including the header file, which tells that the function Screen::show() exists, but probably not linking the library, which has the implementation.

    See this page: 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):

    It looks like maui.lib should contain the screen code.