hi,
I am using following code for making global variable. But I am getting the error:
:: error: duplicate symbol _m_pInstance in citybook.o and main.o
:: error: collect2: ld returned 1 exit status
My code : CityBookGlobalVariables.h
Qt Code:
#ifndef CITYBOOKGLOBALVARIABLES_H #define CITYBOOKGLOBALVARIABLES_H #include <QStringList> class CityBookGlobalVariables { private: CityBookGlobalVariables(){}; CityBookGlobalVariables( const CityBookGlobalVariables& _instance ){}; static CityBookGlobalVariables* m_pInstance; public: QStringList m_cityList; static CityBookGlobalVariables* instance() { if ( !m_pInstance ) m_pInstance = new CityBookGlobalVariables; return m_pInstance; } { m_cityList = cityList; } { return m_cityList; } }; CityBookGlobalVariables* m_pInstance = 0; #endif // CITYBOOKGLOBALVARIABLES_HTo copy to clipboard, switch view to plain text mode
please help me. Thanks in advance
Bookmarks