# include
# include
int main (int argc, char ** argv)
{
QApplication app (argc, argv);
QMessageBox :: information (0, "ok", "ok");
return app.exec ();
}
error message :
.. / nhfjyx / main.cpp: 7: error: undefined reference to 'QApplication :: QApplication (int &, char **, int)'
.. / nhfjyx / main.cpp: 9: error: undefined reference to 'QMessageBox :: information (QWidget *, QString const &, QString const &, QFlags
.. / nhfjyx / main.cpp: 11: error: undefined reference to 'QApplication :: exec ()'
.. / nhfjyx / main.cpp: 11: error: undefined reference to 'QApplication :: ~ QApplication ()'
.. / nhfjyx / main.cpp: 11: error: undefined reference to 'QApplication :: ~ QApplication ()'
collect2: error: ld returned 1 exit status
make: *** [libnhfjyx.so] Error 1
Question: I am in the upper windows and mac have encountered the same problem , what should be the library does not turn in, but I do not know specifically , please help me see , I use Qt5.2 Beta , similar to Qt5.1, below which is being given to three lines of code
QApplication app (argc, argv);
QMessageBox :: information (0, "ok", "ok");
return app.exec ();
------ Solution -------------------- ------------------------
# include
# include
------ Solution --------------------------- -----------------
estimate your . pro file no additional control components.
CONFIG + = widgets or QT + = gui somewhat forgotten. You look at it
------ Solution ------------------------------------ --------
greaterThan (QT_MAJOR_VERSION, 4): QT + = widgets
------ Solution ------------------------------------ --------
greaterThan (QT_MAJOR_VERSION, 5): QT + = widgets
else QT + = gui
------ Solution --------------------------- -----------------
no else, what time will be added gui
Qt Creator generated by default this is
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
------ eference ------------------------------------- -
this man , since Qt5.0 after control class header file are changed to # include
# include
# include
------ eference ------------------- --------------------
Well , ok, get ,. pro file something missing inside
没有评论:
发表评论