{"id":720,"date":"2022-08-30T15:06:03","date_gmt":"2022-08-30T15:06:03","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/09\/qt-creator-3rd-party-lib-undefined-reference-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:06:03","modified_gmt":"2022-08-30T15:06:03","slug":"qt-creator-3rd-party-lib-undefined-reference-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/qt-creator-3rd-party-lib-undefined-reference-collection-of-common-programming-errors\/","title":{"rendered":"QT Creator &#8211; 3rd Party Lib &#8211; Undefined Reference-Collection of common programming errors"},"content":{"rendered":"<p>I have added a 3rd party library to my project in QT Creator. It appears to add fine and the header file is working and it allows QT to auto-complete code with the lib.<\/p>\n<p>When I compile, it has undefined references to the different classes \/ functions in the lib. I&#8217;m assuming that the header file is loading but not the actual lib.<\/p>\n<p>This is what I have in my project file:<\/p>\n<pre><code>win32:CONFIG(release, debug|release): LIBS += -L$$PWD\/..\/..\/Libraries\/BinaryMagic\/Lib\/ -lMCDBVC6R\nelse:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD\/..\/..\/Libraries\/BinaryMagic\/Lib\/ -lMCDBVC6D\n\nINCLUDEPATH += $$PWD\/..\/..\/Libraries\/BinaryMagic\/Include\nDEPENDPATH += $$PWD\/..\/..\/Libraries\/BinaryMagic\/Include\n<\/code><\/pre>\n<p>Its also worth noting that the lib is compiled by and for VC++ 6 and I&#8217;m using minGW32. I contacted the 3rd party lib company and they assured me that there should be no such problem.<\/p>\n<p>So Any Ideas ?<\/p>\n<p>UPDATE: This is the compile output<\/p>\n<pre><code>14:53:16: Running steps for project AV_Command...\n14:53:16: Configuration unchanged, skipping qmake step.\n14:53:16: Starting: \"C:\\Qt\\Qt5.0.1\\Tools\\MinGW\\bin\\mingw32-make.exe\" \nC:\\Qt\\Qt5.0.1\\5.0.1\\mingw47_32\\bin\\qmake.exe -spec win32-g++ -o Makefile ..\\..\\AV_Command\\AV_Command.pro\nC:\/Qt\/Qt5.0.1\/Tools\/MinGW\/bin\/mingw32-make -f Makefile.Release\nmingw32-make[1]: Entering directory 'C:\/Projects\/Builds\/AV_Command-build-Desktop_Qt_5_0_1_MinGW_32bit-Release'\ng++ -Wl,-s -Wl,-subsystem,windows -mthreads -o release\\AV_Command.exe object_script.AV_Command.Release  -lmingw32 -lqtmain -lKernel32 -lShell32 -LC:\/Libraries\/BinaryMagic\/Lib\/ -lMCDBVC6R -LC:\\Qt\\Qt5.0.1\\5.0.1\\mingw47_32\\lib -lQt5Widgets -lQt5Sql -lQt5Xml -lQt5Gui -lQt5Core -llibEGL -llibGLESv2 -lgdi32 -luser32 \n.\/release\\caseburner.o:caseburner.cpp:(.text+0xb0): undefined reference to `CMCDBurner::CMCDBurner()'\n.\/release\\caseburner.o:caseburner.cpp:(.text+0xca): undefined reference to `CMCDBurner::GetDeviceCount()'\nc:\/qt\/qt5.0.1\/tools\/mingw\/bin\/..\/lib\/gcc\/i686-w64-mingw32\/4.7.2\/..\/..\/..\/..\/i686-w64-mingw32\/bin\/ld.exe: .\/release\\caseburner.o: bad reloc address 0xbc in section `.rdata'\ncollect2.exe: error: ld returned 1 exit status\nMakefile.Release:102: recipe for target 'release\\AV_Command.exe' failed\nmingw32-make[1]: *** [release\\AV_Command.exe] Error 1\nmingw32-make[1]: Leaving directory 'C:\/Projects\/Builds\/AV_Command-build-Desktop_Qt_5_0_1_MinGW_32bit-Release'\nmakefile:34: recipe for target 'release' failed\nmingw32-make: *** [release] Error 2\n14:53:17: The process \"C:\\Qt\\Qt5.0.1\\Tools\\MinGW\\bin\\mingw32-make.exe\" exited with code 2.\nError while building\/deploying project AV_Command (kit: Desktop Qt 5.0.1 MinGW 32bit)\nWhen executing step 'Make'\n<\/code><\/pre>\n<ol>\n<li>\n<p>The problem, based upon those error messages, is very likely that minGW32 cannot link against libraries compiled with MSVC.<\/p>\n<p>In particular, the error <code>bad reloc address 0xbc<\/code> is typical of compiler incompatibility (see, for example, this question: Build error: bad reloc address).<\/p>\n<\/li>\n<\/ol>\n<p id=\"rop\"><small>Originally posted 2013-11-09 21:43:38. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>I have added a 3rd party library to my project in QT Creator. It appears to add fine and the header file is working and it allows QT to auto-complete code with the lib. When I compile, it has undefined references to the different classes \/ functions in the lib. I&#8217;m assuming that the header [&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-720","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/720","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=720"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/720\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=720"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=720"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=720"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}