I have copied header file and cpp file from one of my old project( build in VS-2010) into new project( developing it in QT5.1) and have encounter this weird error
1>Message_list.obj : error LNK2019: unresolved external symbol "public: bool __thiscall Message_list::NoMessageTime::operator()(struct Message const &,struct Message const &)const " (??RNoMessageTime@Message_list@@QBE_NABUMessage@@0@Z) referenced in function "bool __cdecl std::_Debug_lt_pred<class Message_list::NoMessageTime,struct Message,struct Message>(class Message_list::NoMessageTime,struct Message &,struct Message const &,wchar_t const *,unsigned int)" (??$_Debug_lt_pred@VNoMessageTime@Message_list@@UMessage@@U3@@std@@YA_NVNoMessageTime@Message_list@@AAUMessage@@ABU3@PB_WI@Z)
I have no idea how to solve it.
In my header file Message_list.h
#include <set>
#include <QSTRING>
#include "Message.h"
class Message_list
{
class NoMessageTime
{
public:
bool operator ()( const Message& left, const Message& right ) const;
};
typedef std::multiset<Message, NoMessageTime> MessageSet;
public:
void add( const Message& message );
private:
/** Inserts an item into the correct place in the list
*/
void Message_list::insert_item( const Message& message );
MainWindow* dialog_;
MessageSet messages_;
};
Message_list.cpp
void Message_list::addd( const Message& message )
{
QMutex mutex;
mutex.lock();
// Do something here
messages_.insert( message ); // error comes here
mutex.unlock();
}
Same files compiled successfully in vs-2010..