Can anyone pls tell me that, why I can’t use normal C++ classes within a Qt programme. If there is any class which aren’t inherited from QObject the compiler give me a linking error called,
error LNK2019: unresolved external symbol _main referenced in function _WinMain@16
I’m using Qt 4.5.2 (compiled by myself) with vs2005. Pls help me to solve this !
Edit:
Example…
//UnitManager.h
class UnitManager
{
public:
//-Some code
};
//CivilizationViewer.h
class CivilizationViewer : public QMainWindow
{
Q_OBJECT
//-some code
};
//main
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
CivilizationViewer w;
w.show();
return a.exec();
}
If I include UnitManager.h in CivilizationViewer.h compiler will give me that error. (eventhough I include UnitManager.h in main.cpp compiler will give me the error)
The error you gave doesn’t have anything to do with what classes you’re using. It looks like it’s related to the entry point you have set for your application. Usually you want to use main() instead of WinMain() in Qt programs. Make sure your configuration is set up right.
You included a little bit of code in your question. Is that everything? If so, you’re missing a main function.