I had a problem at first compiling Qt static on windows, QTBUG-11249
When configured with "-no-qt3support", the build completes fine.
i did that and compiled successfully, but i get the same errors when i try to compile my application.
e:\Qt\2010.04-static\qt\lib/libQtGui.a(qapplication.o):qapplication.cpp:(.text+0x8e0f): undefined reference to _imp___Z21qt_call_post_routinesv'
e:\Qt\2010.04-static\qt\lib/libQtGui.a(qapplication.o):qapplication.cpp:(.text+0x9443): undefined reference to_imp___Z21qt_call_post_routinesv'
e:\Qt\2010.04-static\qt\lib/libQtGui.a(qapplication.o):qapplication.cpp:(.text+0x9a6b): undefined reference to _imp___Z21qt_call_post_routinesv'
e:\Qt\2010.04-static\qt\lib/libQtGui.a(qwhatsthis.o):qwhatsthis.cpp:(.text+0xfc): undefined reference to_imp___Z21qDeleteInEventHandlerP7QObject'
i'm using the mingw version packed with qt, when i use the shared qt dir it works, but when i try to link against the static one it fails.
now i guess it has something to do with -no-qt3support, but i have no idea how to use that in my project.
Related
I've been using Qt 5.15.2 and switching between WebAssembly and Desktop 32-bit in QtCreator for my project. When I switched back to WebAssembly I received the error:
In included file: typedef redefinition with different types ('struct max_align_t' vs 'struct max_align_t')
On my first line:
"#include <QGuiApplication>"This error is persisting now on all WebAssembly projects I create and I even attempted uninstalling and reinstalling Qt
try remove file *.pro.user and load project
I have a Matlab file when I get a qt compiled executable to run using the unix(), but I'm getting an error.
the code:
unix('/home/matt/Desktop/PlaneVolumeFinal/PlaneVolumeGui');
the error:
/home/matt/Desktop/PlaneVolumeFinal/PlaneVolumeGui: symbol lookup error: /home/matt/Desktop
/PlaneVolumeFinal/PlaneVolumeGui: undefined symbol: _ZN9QListData7detach3Ev
The dynamically linked libraries are linked when the application is started, the error is saying that the OS cannot find the library that contains the stuff for QList, that library is QtCore.
Make sure Qt's runtime libraries are somewhere where the OS can find them - usually /usr/lib(64). My guess is that you do not have the runtimes but are using Qt's SDK, so QtCreator uses those for compiling - but they are not on your OS's path for when it is ran outside of that.
I have followed the instructions on http://doc.qt.nokia.com/stable/sql-driver.html#qibase for compiling Interbase support into Qt, and made sure all of my libraries are in the right place. qmake runs successfully, but when I run nmake, I get a series of undefined reference errors in qsql_ibase.cpp. If I open up the .pro in Qt Creator and hover over one of the functions that is throwing the undefined reference errors and follow the symbol (F2), it takes me to the ibase.h file where it is declared. Is it throwing the undefined reference errors because there is no function definition? If that is the case, why isn't it giving me any errors about a missing library?
Output example:
Creating library file: debug\libqsqlibased4.a
debug/qsql_ibase.o: In function getIBaseError':
C:\QtSDK\QtSources\4.7.4\src\plugins\sqldrivers\ibase/../../../sql/drivers/ibase
/qsql_ibase.cpp:80: undefined reference toisc_sqlcode'
C:\QtSDK\QtSources\4.7.4\src\plugins\sqldrivers\ibase/../../../sql/drivers/ibase
/qsql_ibase.cpp:85: undefined reference to isc_interprete'
debug/qsql_ibase.o:C:\QtSDK\QtSources\4.7.4\src\plugins\sqldrivers\ibase/../../.
./sql/drivers/ibase/qsql_ibase.cpp:406: undefined reference toisc_dsql_free_st
atement'
debug/qsql_ibase.o:C:\QtSDK\QtSources\4.7.4\src\plugins\sqldrivers\ibase/../../.
./sql/drivers/ibase/qsql_ibase.cpp:421: undefined reference to isc_create_blob2
'
debug/qsql_ibase.o:C:\QtSDK\QtSources\4.7.4\src\plugins\sqldrivers\ibase/../../.
./sql/drivers/ibase/qsql_ibase.cpp:427: undefined reference toisc_put_segment'
This continues for many more errors, all undefined references.
That really sounds like the first issue mentioned under the "Troubleshooting" section of the page to which you link above:
You should always use client libraries that have been compiled with
the same compiler as you are using for your project. If you cannot get
a source distibution to compile the client libraries yourself, you
must make sure that the pre-compiled library is compatible with your
compiler, otherwise you will get a lot of "undefined symbols" errors.
Some compilers have tools to convert libraries, e.g. Borland ships the
tool COFF2OMF.EXE to convert libraries that have been generated with
Microsoft Visual C++.
Which compiler are you using to compile Qt, and where did you get the Interbase libraries? You also need to make sure those libraries can be found at link time. If you look at the output of your compiler, it should show you all the link directories in which it is searching (in addition to any globally defined, like PATH in Windows.) If the folder with your Interbase library is listed, it is probably that the compiler versions aren't matching.
Sorry for raising so old theme, but I found a solution and want to share with it. The problem is that macro ISC_EXPORT was not defined in Interbase's SDK due to conditional compilation defines. See details here - Howto build Interbase plugin for Qt by MinGW
I have a static library that I have built with MinGW, I am trying to link to that library from a Qt application. I keep getting linker errors caused by one of the object files in the library. This file actually declares a couple of Boost headers, one for use of shared_ptr and the other so I can make a class noncopyable. I believe using this boost functionality is what is causing the issue but I have no idea why. If I comment out the classes in the Qt app that use the class defined in the file, the Qt app links fine. This is the error part of the output:
C:\blah\build\windows\mingw\libfoo.a(foo_ctis.cpp.obj):foo_ctis.cpp:(.text+0x10a):
undefined reference to
`__gxx_personality_sj0'
C:\blah\build\windows\mingw\libfoo.a(foo_ctis.cpp.obj):foo_ctis.cpp:(.text+0x12f):
undefined reference to
`_Unwind_SjLj_Register'
C:\blah\build\windows\mingw\libfoo.a(foo_ctis.cpp.obj):foo_ctis.cpp:(.text+0x203):
undefined reference to
`_Unwind_SjLj_Resume'
C:\blah\build\windows\mingw\libfoo.a(foo_ctis.cpp.obj):foo_ctis.cpp:(.text+0x20e):
undefined reference to
`_Unwind_SjLj_Unregister'
C:\blah\build\windows\mingw\libfoo.a(foo_ctis.cpp.obj):foo_ctis.cpp:(.text+0x226):
undefined reference to
`__gxx_personality_sj0'
C:\blah\build\windows\mingw\libfoo.a(foo_ctis.cpp.obj):foo_ctis.cpp:(.text+0x24b):
undefined reference to
`_Unwind_SjLj_Register'
C:\blah\build\windows\mingw\libfoo.a(foo_ctis.cpp.obj):foo_ctis.cpp:(.text+0x31f):
undefined reference to
`_Unwind_SjLj_Resume'
C:\blah\build\windows\mingw\libfoo.a(foo_ctis.cpp.obj):foo_ctis.cpp:(.text+0x32a):
undefined reference to
`_Unwind_SjLj_Unregister'
C:\blah\build\windows\mingw\libfoo.a(foo_ctis.cpp.obj):foo_ctis.cpp:(.text$_ZN5boost6detail12shared_countC1IN3foo25foo_SomeClassImplEEEPT_[boost::detail::shared_count::shared_count(foo::foo_SomeClassImpl*)]+0xc):
undefined reference to
`__gxx_personality_sj0'
C:\blah\build\windows\mingw\libfoo.a(foo_ctis.cpp.obj):foo_ctis.cpp:(.text$_ZN5boost6detail12shared_countC1IN3foo25foo_SomeClassImplEEEPT_[boost::detail::shared_count::shared_count(foo::foo_SomeClassImpl*)]+0x31):
undefined reference to
`_Unwind_SjLj_Register'
C:\blah\build\windows\mingw\libfoo.a(foo_ctis.cpp.obj):foo_ctis.cpp:(.text$_ZN5boost6detail12shared_countC1IN3foo25foo_SomeClassImplEEEPT_[boost::detail::shared_count::shared_count(foo::foo_SomeClassImpl*)]+0xfb):
undefined reference to
`_Unwind_SjLj_Resume'
C:\blah\build\windows\mingw\libfoo.a(foo_ctis.cpp.obj):foo_ctis.cpp:(.text$_ZN5boost6detail12shared_countC1IN3foo25foo_SomeClassImplEEEPT_[boost::detail::shared_count::shared_count(foo::foo_SomeClassImpl*)]+0x106):
undefined reference to
`_Unwind_SjLj_Unregister' collect2: ld
returned 1 exit status
One other thing to mention is that I am using a pointer to implementation in this class.
Any help would be much appreciated.
Solved:
I figured out that I had an older version of GCC in my path that was beng included before my MinGW supplied GCC version. The old version was included in a GNUStep package that I had from awhile back. I think that configuration of these different versions was causing problems. Thanks to kemiisto, who was on the right track in solving the issue.
It seems that your static library was linked against one MinGW distribution (i.e. 3rd version) but you try to link your application with this library using other MinGW distribution (i.e. 4th version which is distributed with binary Qt). You should rebuild your library using the same MinGW which you use for your application development.
Update
May be it's another well known problem. Take a look at this topic. You probably have 2 different folders with Qt libs
C:\Qt\2009.05\bin;C:\Qt\2009.05\qt\bin
in your path too. Libraries in the first folder (...\bin) compiled with VS2008 and libraries in the second one (...\qt\bin) compiled with MinGW. The items in path variable are looked up when your application starts. Suddenly the folder with "wrong" libraries exists before the folder with correct item in your path variable. What you can do is to copy QtCore4.dll, QtGui4.dll and other libraries that you need to folder with your application executable. Hope this helps.
Some links about this problem:
#qtforum.org
#some blog post (in Russian =))
Just in case anyone else has this problem: my project rebuild was using .o files from a previous build. I changed compilers in between.
Turns out that when I rebuilt the same project, the new compiler didn't build new .o files, so they were missing some key info. After deleting the old files and rebuilding, the error was fixed.
I assume rebuilding from scratch, without the delete, would work the same.
you may have used gcc instead of g++. gcc is a C compiler. but g++ is a c++ compiler.
just make sure to use g++ if you have .cpp files.
I'm trying to link a Qt application with its libraries and the linker (MinGW) spews hundreds of lines like the following, and I am unsure how to proceed.
cpp: undefined reference to `_Unwind_SjLj_Register'
c:/qt/lib/libQtCore.a(qcoreapplication_win.o)(.text+0x29d):qcoreapplication_win.
cpp: undefined reference to `_Unwind_SjLj_Unregister'
c:/qt/lib/libQtCore.a(qcoreapplication_win.o)(.text+0x38c):qcoreapplication_win.
cpp: undefined reference to `_Unwind_SjLj_Resume'
c:/qt/lib/libQtCore.a(qcoreapplication_win.o)(.text+0x4ce):qcoreapplication_win.
cpp: undefined reference to `_Unwind_SjLj_Register'
c:/qt/lib/libQtCore.a(qcoreapplication_win.o)(.text+0x53e):qcoreapplication_win.
cpp: undefined reference to `_Unwind_SjLj_Unregister'
c:/qt/lib/libQtCore.a(qcoreapplication_win.o)(.text+0x635):qcoreapplication_win.
cpp: undefined reference to `_Unwind_SjLj_Resume'
I don't know... but to me, spewing stuff about Unwind suggests that you have a mismatch between whether the library is compiled with exceptions and your application is compiled with exceptions.
If you want exceptions, make sure you have enabled them by adding the following line in your qmake file:
CONFIG += exceptions
or, if you do not want exceptions, use the opposite
CONFIG -= exceptions
And whatever you do, do not use C++ compiler options to set this yourself.
It's been a while since I did any Qt development, but there were only a couple instances that I remember spewing out huge numbers of messages like this.
Include files for Qt were a
different version than the shared
libraries ... this happened when I
upgraded and for some reason, you
had to manually upgrade the include
files.
The Qt libraries were missing altogether ... I vaguely remember the compiler working, but the linker failing when I first started.
I was doing Qt development targeted at an ARM processor, so I had extra oddities involved when cross-compiling.
2 possible reasons that i know of:
if you try to link gcc4 libraries with a gcc3 linker.
You need the -lstdc++ flag to the end of the compile command