{"id":959,"date":"2022-08-30T15:10:02","date_gmt":"2022-08-30T15:10:02","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/09\/compiling-wtwithqt-example-with-qtcreatorqmake-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:10:02","modified_gmt":"2022-08-30T15:10:02","slug":"compiling-wtwithqt-example-with-qtcreatorqmake-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/compiling-wtwithqt-example-with-qtcreatorqmake-collection-of-common-programming-errors\/","title":{"rendered":"Compiling wtwithqt example with QtCreator(qmake)-Collection of common programming errors"},"content":{"rendered":"<p>I am working on a network management application with Qt and I chose to use Wt for UI, because with it I will not have to deal with any of web parts (PHP, AJAX, HTML\/CSS) and it&#8217;ll be usable on all platforms.<\/p>\n<p>I successfully managed to compile and run examples using cmake. Although I am used to QtCreator IDE and qmake I would rather use that for development and compiling.<\/p>\n<p><strong>I got stuck trying to compile &#8220;wtwithqt&#8221; example in QtCreator(qmake).<\/strong> I&#8217;ve been searching everywhere for some guide how to compile it with qmake. However I found nothing helpful.<\/p>\n<p>Here is my .pro file.<\/p>\n<p><em>testWt.pro<\/em><\/p>\n<pre><code>QT += core\nQT -= gui\n\nTARGET = helloqt\nCONFIG += console no_keywords\nCONFIG -=app_bundle\n\nTEMPLATE = app\n\nINCLUDEPATH += lib\n\nLIBS += -lwt -lwthttp -lboost_signals -lboost_system -lboost_regex\n\nQMAKE_CXXFLAGS += -DNDEBUG\n\nHEADERS += \\\n    QtObject.h \\\n    HelloApplication.h\n\nSOURCES += \\\n    hello.cpp \\\n    QtObject.cpp\n<\/code><\/pre>\n<p>Compile ouput<\/p>\n<pre><code>13:28:15: Running build steps for project testWt...\n13:28:15: Starting: \"\/usr\/bin\/make\" clean -w\nmake: Entering directory `\/home\/nms-development\/QtProject\/testWt-build-desktop-Qt_4_8_1_in_PATH__System__Debug'\n\/usr\/bin\/qmake-qt4 -spec \/usr\/share\/qt4\/mkspecs\/linux-g++ CONFIG+=debug CONFIG+=declarative_debug -o Makefile ..\/testWt\/testWt.pro\nmake: Leaving directory `\/home\/nms-development\/QtProject\/testWt-build-desktop-Qt_4_8_1_in_PATH__System__Debug'\nmake: Entering directory `\/home\/nms-development\/QtProject\/testWt-build-desktop-Qt_4_8_1_in_PATH__System__Debug'\nrm -f moc_QtObject.cpp\nrm -f hello.o QtObject.o moc_QtObject.o\nrm -f *~ core *.core\nmake: Leaving directory `\/home\/nms-development\/QtProject\/testWt-build-desktop-Qt_4_8_1_in_PATH__System__Debug'\n13:28:15: The process \"\/usr\/bin\/make\" exited normally.\n13:28:15: Configuration unchanged, skipping qmake step.\n13:28:15: Starting: \"\/usr\/bin\/make\" -w\nmake: Entering directory `\/home\/nms-development\/QtProject\/testWt-build-desktop-Qt_4_8_1_in_PATH__System__Debug'\ng++ -c -pipe -DNDEBUG -g -Wall -W -D_REENTRANT -DQT_WEBKIT -DQT_NO_KEYWORDS -DQT_CORE_LIB -DQT_SHARED -I\/usr\/share\/qt4\/mkspecs\/linux-g++ -I..\/testWt -I\/usr\/include\/qt4\/QtCore -I\/usr\/include\/qt4 -I..\/testWt\/lib -I. -I..\/testWt -I. -o hello.o ..\/testWt\/hello.cpp\ng++ -c -pipe -DNDEBUG -g -Wall -W -D_REENTRANT -DQT_WEBKIT -DQT_NO_KEYWORDS -DQT_CORE_LIB -DQT_SHARED -I\/usr\/share\/qt4\/mkspecs\/linux-g++ -I..\/testWt -I\/usr\/include\/qt4\/QtCore -I\/usr\/include\/qt4 -I..\/testWt\/lib -I. -I..\/testWt -I. -o QtObject.o ..\/testWt\/QtObject.cpp\n\/usr\/bin\/moc-qt4 -DQT_WEBKIT -DQT_NO_KEYWORDS -DQT_CORE_LIB -DQT_SHARED -I\/usr\/share\/qt4\/mkspecs\/linux-g++ -I..\/testWt -I\/usr\/include\/qt4\/QtCore -I\/usr\/include\/qt4 -I..\/testWt\/lib -I. -I..\/testWt -I. ..\/testWt\/QtObject.h -o moc_QtObject.cpp\ng++ -c -pipe -DNDEBUG -g -Wall -W -D_REENTRANT -DQT_WEBKIT -DQT_NO_KEYWORDS -DQT_CORE_LIB -DQT_SHARED -I\/usr\/share\/qt4\/mkspecs\/linux-g++ -I..\/testWt -I\/usr\/include\/qt4\/QtCore -I\/usr\/include\/qt4 -I..\/testWt\/lib -I. -I..\/testWt -I. -o moc_QtObject.o moc_QtObject.cpp\ng++  -o helloqt hello.o QtObject.o moc_QtObject.o    -L\/usr\/lib\/i386-linux-gnu -lwt -lwthttp -lboost_signals -lboost_system -lboost_regex -lQtCore -lpthread \nhello.o: In function `HelloApplication':\n\/home\/nms-development\/QtProject\/testWt-build-desktop-Qt_4_8_1_in_PATH__System__Debug\/..\/testWt\/hello.cpp:43: undefined reference to `Wt::WQApplication::WQApplication(Wt::WEnvironment const&amp;, bool)'\nhello.o: In function `HelloApplication::propagateGreet()':\n\/home\/nms-development\/QtProject\/testWt-build-desktop-Qt_4_8_1_in_PATH__System__Debug\/..\/testWt\/hello.cpp:87: undefined reference to `Wt::toQString(Wt::WString const&amp;)'\nhello.o: In function `HelloApplication::doGreet(QString const&amp;)':\n\/home\/nms-development\/QtProject\/testWt-build-desktop-Qt_4_8_1_in_PATH__System__Debug\/..\/testWt\/hello.cpp:92: undefined reference to `Wt::toWString(QString const&amp;)'\nhello.o: In function `~WQApplication':\n\/home\/nms-development\/QtProject\/testWt-build-desktop-Qt_4_8_1_in_PATH__System__Debug\/..\/testWt\/lib\/WQApplication:82: undefined reference to `vtable for Wt::WQApplication'\nhello.o:(.rodata._ZTV16HelloApplication[vtable for HelloApplication]+0x3c): undefined reference to `Wt::WQApplication::initialize()'\nhello.o:(.rodata._ZTV16HelloApplication[vtable for HelloApplication]+0x40): undefined reference to `Wt::WQApplication::finalize()'\nhello.o:(.rodata._ZTV16HelloApplication[vtable for HelloApplication]+0x44): undefined reference to `Wt::WQApplication::notify(Wt::WEvent const&amp;)'\nhello.o:(.rodata._ZTV16HelloApplication[vtable for HelloApplication]+0x5c): undefined reference to `Wt::WQApplication::realNotify(Wt::WEvent const&amp;)'\nhello.o:(.rodata._ZTI16HelloApplication[typeinfo for HelloApplication]+0x8): undefined reference to `typeinfo for Wt::WQApplication'\ncollect2: ld returned 1 exit status\nmake: Leaving directory `\/home\/nms-development\/QtProject\/testWt-build-desktop-Qt_4_8_1_in_PATH__System__Debug'\nmake: *** [helloqt] Error 1\n13:28:28: The process \"\/usr\/bin\/make\" exited with code 2.\nError while building project testWt (target: Desktop)\nWhen executing build step 'Make'\n<\/code><\/pre>\n<p>Any help is appreciated! Thanks in advance!<\/p>\n<ol>\n<li>\n<p>Your makefile is pretty much sound, but I think you&#8217;ve forgotten to link the <code>wtwitqt<\/code> interop layer. Add <code>-lwtwithqt<\/code> to the <code>LIBS<\/code> line,<\/p>\n<\/li>\n<\/ol>\n<p id=\"rop\"><small>Originally posted 2013-11-09 23:06:58. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>I am working on a network management application with Qt and I chose to use Wt for UI, because with it I will not have to deal with any of web parts (PHP, AJAX, HTML\/CSS) and it&#8217;ll be usable on all platforms. I successfully managed to compile and run examples using cmake. Although I am [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-959","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/959","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=959"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/959\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=959"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=959"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=959"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}