[Qt-interest] Small problem with QMap

Juan D Guzman lostinthecode at googlemail.com
Wed Mar 11 16:11:20 CET 2009


Ok so I am still trying to learn the ropes in C++ coming from a C# 
background.  I have the following code

class Sample

{

public:

    Sample()

    {

    }

    ~Sample()

    {

    }

    static void addItem(QString key, MainMenuI *iMenu);

private:

    static QMap<QString, MainMenuI *> items;

};


and in my cpp file i have the following


void Sample::addItem(QString key, MainMenuI *iMenu)
{
    items.insert(key, iMenu);

}


when i try to compile though i get the following error:


sample.obj:-1: error:  unresolved external symbol "private: static class 
QMap<class QString,class MainMenuI *> Sample::items" 
(?items at Sample@@0V?$QMap at VQString@@PAVMainMenuI@@@@A)


any ideas?




More information about the Qt-interest-old mailing list