{"id":1336,"date":"2022-08-30T15:15:41","date_gmt":"2022-08-30T15:15:41","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/10\/problem-about-qt5-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:15:41","modified_gmt":"2022-08-30T15:15:41","slug":"problem-about-qt5-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/problem-about-qt5-collection-of-common-programming-errors\/","title":{"rendered":"problem about qt5-Collection of common programming errors"},"content":{"rendered":"<ul>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/3dfb0310981efee3025bc7f09d8d1a89?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nAddy<br \/>\nc++ qt qt4 cmake qt5<br \/>\nI have a project that I originally started developing using Qt4 and am now working on migrating to Qt5. After a couple hours reworking some code and removing newly deprecated calls, I was able to get the project to compile but now I&#8217;m having problems getting it to link.I am using CMake to generate the project files. I started migrating by first modifying the &#8220;solutions&#8217;s&#8221; CMake file and replacing:############################################# # find QT FIND_PACKAGE(Qt4 REQUIRED)# configure QT modules SET(QT_USER_QTCORE TRUE) SET(QT_USE_QTMAIN TRUE) SET(QT_USE_QTWEBKIT TRUE) SET(QT_USE_QTNETWORK TRUE) SET(QT_USE_QTSQL TRUE)SET(QT_USE_QTXML TRUE) SET(QT_USE_QTUITOOLS TRUE)# include QT requirements INCLUDE(${QT_USE_FILE}) ADD_DEFINITIONS(${QT_DEFINITIONS}) #############################################with (this needs to be cleaned up)############################################# # find QT set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_AUTOMOC ON)FIND_PACKAGE(Qt5Concurrent REQUIRED) FIND_PACKAGE(Qt5Core REQUIRED) FIND_PACKAGE(Qt5Network REQUIRED) FIND_PACKAGE(Qt5Sql REQUIRED) FIND_PACKAGE(Qt5WebKit REQUIRED) FIND_PACKAGE(Qt5WebKitWidgets REQUIRED) FIND_PACKAGE(Qt5Widgets REQUIRED) FIND_PACKAGE(Qt5Xml REQUIRED)INCLUDE_DIRECTORIES(${Qt5Concurrent_INCLUDE_DIRS}${QT5_FOLDER}&#8221;C:\/Qt\/Qt5.0.2\/5.0.2\/msvc2012_64\/include&#8221; )ADD_DEFINITIONS(${QT_DEFINITIONS}) #############################################After this, I commented out all my calls to ADD_SUBDIRECTORY() and started adding them back in one at a time. My project uses Log4Qt and since that has no other dependencies on other subdirectories, it was the first subproject I started working on.In Log4Qt&#8217;s CMakeLists.txt file, I simply changed QT4_WRAP_CPP(MOC_SOURCE_FILES ${MOC_HEADERS}) to QT5_WRAP_CPP(MOC_SOURCE_FILES ${MOC_HEADERS}), with MOC_HEADERS being defined as all the necessarily MOC&#8217;d headers in Log4Qt.When I load this up in VS2013 and build, it compiles fine but linking throws the same warnings for every moc_*:&gt;moc_stringmatchfilter.obj : warning LNK4006: &#8220;public: static struct QMetaObject co<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/a0e9a52555bc8c0ac3e5c9248506c01a?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nalexandernst<br \/>\nc++ sockets qt5<br \/>\nI have a problem reading more than 2048 bytes from a QLocalSocket. This is my server-side code:clientConnection-&gt;flush(); \/\/<\/li>\n<\/ul>\n<p id=\"rop\"><small>Originally posted 2013-11-10 00:29:27. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>Addy c++ qt qt4 cmake qt5 I have a project that I originally started developing using Qt4 and am now working on migrating to Qt5. After a couple hours reworking some code and removing newly deprecated calls, I was able to get the project to compile but now I&#8217;m having problems getting it to link.I [&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-1336","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1336","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=1336"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1336\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=1336"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=1336"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=1336"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}