Discussion:
[Interest] Strange unresolved external symbols in QtCore on windows
Patrick Stinson
2018-11-03 21:31:12 UTC
Permalink
My qmake-generated Visual studio project is complaining about the following QObject symbols referenced from my QObject subclass even though I am linking to Qt5Core.lib using a qt I built from the command line:


1>CUtil.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall QObject::timerEvent(class QTimerEvent *)" (?***@QObject@@UAEXPAVQTimerEvent@@@Z)
1>CUtil_win32.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall QObject::timerEvent(class QTimerEvent *)" (?***@QObject@@UAEXPAVQTimerEvent@@@Z)
1>sip_cutilAppFilter.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall QObject::timerEvent(class QTimerEvent *)" (?***@QObject@@UAEXPAVQTimerEvent@@@Z)
1>CUtil.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall QObject::childEvent(class QChildEvent *)" (?***@QObject@@UAEXPAVQChildEvent@@@Z)
1>CUtil_win32.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall QObject::childEvent(class QChildEvent *)" (?***@QObject@@UAEXPAVQChildEvent@@@Z)
1>sip_cutilAppFilter.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall QObject::childEvent(class QChildEvent *)" (?***@QObject@@UAEXPAVQChildEvent@@@Z)
1>CUtil.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall QObject::customEvent(class QEvent *)" (?***@QObject@@UAEXPAVQEvent@@@Z)
1>CUtil_win32.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall QObject::customEvent(class QEvent *)" (?***@QObject@@UAEXPAVQEvent@@@Z)
1>sip_cutilAppFilter.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall QObject::customEvent(class QEvent *)" (?***@QObject@@UAEXPAVQEvent@@@Z)
1>CUtil.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall QObject::connectNotify(class QMetaMethod const &)" (?***@QObject@@UAEXABVQMetaMethod@@@Z)
1>CUtil_win32.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall QObject::connectNotify(class QMetaMethod const &)" (?***@QObject@@UAEXABVQMetaMethod@@@Z)
1>sip_cutilAppFilter.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall QObject::connectNotify(class QMetaMethod const &)" (?***@QObject@@UAEXABVQMetaMethod@@@Z)
1>CUtil.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall QObject::disconnectNotify(class QMetaMethod const &)" (?***@QObject@@UAEXABVQMetaMethod@@@Z)
1>CUtil_win32.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall QObject::disconnectNotify(class QMetaMethod const &)" (?***@QObject@@UAEXABVQMetaMethod@@@Z)
1>sip_cutilAppFilter.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall QObject::disconnectNotify(class QMetaMethod const &)" (?***@QObject@@UAEXABVQMetaMethod@@@Z)


The output of dumpbin /symbols /linenumbers Qt5Core.lib shows these symbols as protected, not public as referenced above


516 00000000 UNDEF notype () External | ?***@QObject@@MAEXPAVQTimerEvent@@@Z (protected: virtual void __thiscall QObject::timerEvent(class QTimerEvent *))
517 00000000 UNDEF notype () External | ?***@QObject@@MAEXPAVQChildEvent@@@Z (protected: virtual void __thiscall QObject::childEvent(class QChildEvent *))


But then, maybe the public/private status of these isn’t the problem.

Anyone have any idea what might be causing this? Here is my linker command line:


OUT:"release\\Family Diagram.exe" /MANIFEST /NXCOMPAT /PDB:"release\Family Diagram.pdb" /DYNAMICBASE "Y:\dev\vendor\sysroot-win-32\qt\lib\qtmain.lib" "Y:\dev\vendor\sysroot-win-32\lib\python3.6\site-packages\PyQt5\Qt.lib" "Y:\dev\vendor\sysroot-win-32\lib\python3.6\site-packages\PyQt5\QtCore.lib" "Y:\dev\vendor\sysroot-win-32\lib\python3.6\site-packages\PyQt5\QtGui.lib" "Y:\dev\vendor\sysroot-win-32\lib\python3.6\site-packages\PyQt5\QtLocation.lib" "Y:\dev\vendor\sysroot-win-32\lib\python3.6\site-packages\PyQt5\QtNetwork.lib" "Y:\dev\vendor\sysroot-win-32\lib\python3.6\site-packages\PyQt5\QtPositioning.lib" "Y:\dev\vendor\sysroot-win-32\lib\python3.6\site-packages\PyQt5\QtPrintSupport.lib" "Y:\dev\vendor\sysroot-win-32\lib\python3.6\site-packages\PyQt5\QtPurchasing.lib" "Y:\dev\vendor\sysroot-win-32\lib\python3.6\site-packages\PyQt5\QtQml.lib" "Y:\dev\vendor\sysroot-win-32\lib\python3.6\site-packages\PyQt5\QtQuick.lib" "Y:\dev\vendor\sysroot-win-32\lib\python3.6\site-packages\PyQt5\QtQuickWidgets.lib" "Y:\dev\vendor\sysroot-win-32\lib\python3.6\site-packages\PyQt5\QtWidgets.lib" "Y:\dev\vendor\sysroot-win-32\lib\python36.lib" "Y:\dev\vendor\sysroot-win-32\lib\python3.6\site-packages\PyQt5\sip.lib" "Y:\dev\vendor\sysroot-win-32\qt\plugins\printsupport\windowsprintersupport.lib" "Y:\dev\vendor\sysroot-win-32\qt\plugins\styles\qwindowsvistastyle.lib" "Y:\dev\vendor\sysroot-win-32\qt\plugins\geoservices\qtgeoservices_esri.lib" "Y:\dev\vendor\sysroot-win-32\qt\plugins\geoservices\qtgeoservices_itemsoverlay.lib" "Y:\dev\vendor\sysroot-win-32\qt\plugins\geoservices\qtgeoservices_mapbox.lib" "Y:\dev\vendor\sysroot-win-32\qt\plugins\geoservices\qtgeoservices_nokia.lib" "Y:\dev\vendor\sysroot-win-32\qt\plugins\geoservices\qtgeoservices_osm.lib" "Y:\dev\vendor\sysroot-win-32\qt\lib\Qt5Concurrent.lib" "Y:\dev\vendor\sysroot-win-32\qt\plugins\scenegraph\qsgd3d12backend.lib" "dxgi.lib" "d3d12.lib" "d3dcompiler.lib" "dcomp.lib" "Y:\dev\vendor\sysroot-win-32\qt\plugins\platforms\qwindows.lib" "imm32.lib" "oleaut32.lib" "shlwapi.lib" "Y:\dev\vendor\sysroot-win-32\qt\lib\Qt5EventDispatcherSupport.lib" "Y:\dev\vendor\sysroot-win-32\qt\lib\Qt5FontDatabaseSupport.lib" "Y:\dev\vendor\sysroot-win-32\qt\lib\qtfreetype.lib" "Y:\dev\vendor\sysroot-win-32\qt\lib\Qt5ThemeSupport.lib" "Y:\dev\vendor\sysroot-win-32\qt\lib\Qt5AccessibilitySupport.lib" "Y:\dev\vendor\sysroot-win-32\qt\lib\Qt5WindowsUIAutomationSupport.lib" "Y:\dev\vendor\sysroot-win-32\qt\plugins\imageformats\qgif.lib" "Y:\dev\vendor\sysroot-win-32\qt\plugins\imageformats\qico.lib" "Y:\dev\vendor\sysroot-win-32\qt\plugins\imageformats\qjpeg.lib" "Y:\dev\vendor\sysroot-win-32\qt\plugins\qmltooling\qmldbg_debugger.lib" "Y:\dev\vendor\sysroot-win-32\qt\plugins\qmltooling\qmldbg_inspector.lib" "Y:\dev\vendor\sysroot-win-32\qt\plugins\qmltooling\qmldbg_local.lib" "Y:\dev\vendor\sysroot-win-32\qt\plugins\qmltooling\qmldbg_messages.lib" "Y:\dev\vendor\sysroot-win-32\qt\plugins\qmltooling\qmldbg_native.lib" "Y:\dev\vendor\sysroot-win-32\qt\plugins\qmltooling\qmldbg_nativedebugger.lib" "Y:\dev\vendor\sysroot-win-32\qt\plugins\qmltooling\qmldbg_profiler.lib" "Y:\dev\vendor\sysroot-win-32\qt\plugins\qmltooling\qmldbg_quickprofiler.lib" "Y:\dev\vendor\sysroot-win-32\qt\plugins\qmltooling\qmldbg_server.lib" "Y:\dev\vendor\sysroot-win-32\qt\lib\Qt5PacketProtocol.lib" "Y:\dev\vendor\sysroot-win-32\qt\plugins\qmltooling\qmldbg_tcp.lib" "Y:\dev\vendor\sysroot-win-32\qt\plugins\bearer\qgenericbearer.lib" "Y:\dev\vendor\sysroot-win-32\qt\plugins\position\qtposition_geoclue.lib" "Y:\dev\vendor\sysroot-win-32\qt\lib\Qt5DBus.lib" "Y:\dev\vendor\sysroot-win-32\qt\plugins\position\qtposition_positionpoll.lib" "Y:\dev\vendor\sysroot-win-32\qt\plugins\position\qtposition_winrt.lib" "runtimeobject.lib" "Y:\dev\vendor\sysroot-win-32\qt\lib\Qt5PrintSupport.lib" "winspool.lib" "comdlg32.lib" "gdi32.lib" "Y:\dev\vendor\sysroot-win-32\qt\lib\Qt5QuickWidgets.lib" "Y:\dev\vendor\sysroot-win-32\qt\lib\Qt5Widgets.lib" "uxtheme.lib" "dwmapi.lib" "Y:\dev\vendor\sysroot-win-32\qt\lib\Qt5Location.lib" "Y:\dev\vendor\sysroot-win-32\qt\lib\Qt5PositioningQuick.lib" "Y:\dev\vendor\sysroot-win-32\qt\lib\Qt5Purchasing.lib" "Y:\dev\vendor\sysroot-win-32\qt\lib\Qt5Positioning.lib" "Y:\dev\vendor\sysroot-win-32\qt\lib\clip2tri.lib" "Y:\dev\vendor\sysroot-win-32\qt\lib\poly2tri.lib" "Y:\dev\vendor\sysroot-win-32\qt\lib\clipper.lib" "Y:\dev\vendor\sysroot-win-32\qt\qml\QtQuick.2\qtquick2plugin.lib" "Y:\dev\vendor\sysroot-win-32\qt\lib\Qt5Quick.lib" "Y:\dev\vendor\sysroot-win-32\qt\lib\Qt5Gui.lib" "libEGL.lib" "libGLESv2.lib" "Y:\dev\vendor\sysroot-win-32\qt\lib\qtlibpng.lib" "Y:\dev\vendor\sysroot-win-32\qt\lib\qtharfbuzz.lib" "Y:\dev\vendor\sysroot-win-32\qt\lib\Qt5Qml.lib" "Y:\dev\vendor\sysroot-win-32\qt\lib\Qt5Network.lib" "dnsapi.lib" "iphlpapi.lib" "crypt32.lib" "Y:\dev\vendor\sysroot-win-32\lib\libssl.lib" "Y:\dev\vendor\sysroot-win-32\lib\libcrypto.lib" "Gdi32.lib" "Y:\dev\vendor\sysroot-win-32\qt\lib\Qt5Core.lib" "mpr.lib" "netapi32.lib" "userenv.lib" "version.lib" "ws2_32.lib" "kernel32.lib" "user32.lib" "shell32.lib" "uuid.lib" "ole32.lib" "advapi32.lib" "winmm.lib" "Y:\dev\vendor\sysroot-win-32\qt\lib\qtpcre2.lib" "Y:\dev\vendor\sysroot-win-32\qt\lib\libEGL.lib" "Y:\dev\vendor\sysroot-win-32\qt\lib\libGLESv2.lib" "d3d9.lib" "dxguid.lib" "Y:\dev\vendor\sysroot-win-32\qt\lib\translator.lib" "Y:\dev\vendor\sysroot-win-32\qt\lib\preprocessor.lib" "odbc32.lib" "odbccp32.lib" /MACHINE:X86 /SAFESEH /INCREMENTAL:NO /PGD:"release\Family Diagram.pgd" /SUBSYSTEM:WINDOWS /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /ManifestFile:"release\Family Diagram.exe.intermediate.manifest" /ERRORREPORT:PROMPT /NOLOGO /LIBPATH:"Y:\dev\vendor\sysroot-win-32\qt\lib" /LIBPATH:"Y:\dev\vendor\sysroot-win-32\lib" /LIBPATH:"Y:\dev\vendor\sysroot-win-32\lib\python3.6\site-packages\PyQt5" /LIBPATH:"Y:\dev\vendor\sysroot-win-32\qt\plugins\printsupport" /LIBPATH:"Y:\dev\vendor\sysroot-win-32\qt\plugins\styles" /LIBPATH:"Y:\dev\vendor\sysroot-win-32\qt\plugins\geoservices" /LIBPATH:"Y:\dev\vendor\sysroot-win-32\qt\plugins\scenegraph" /LIBPATH:"Y:\dev\vendor\sysroot-win-32\qt\plugins\platforms" /LIBPATH:"Y:\dev\vendor\sysroot-win-32\qt\plugins\imageformats" /LIBPATH:"Y:\dev\vendor\sysroot-win-32\qt\plugins\qmltooling" /LIBPATH:"Y:\dev\vendor\sysroot-win-32\qt\plugins\bearer" /LIBPATH:"Y:\dev\vendor\sysroot-win-32\qt\plugins\position" /LIBPATH:"Y:\dev\vendor\sysroot-win-32\qt\qml\QtQuick.2" /TLBID:1
Thiago Macieira
2018-11-04 03:41:53 UTC
Permalink
Post by Patrick Stinson
The output of dumpbin /symbols /linenumbers Qt5Core.lib shows these symbols
as protected, not public as referenced above
That is correct. They are protected.

Search your sources for a

#define protected public

Find it and remove it.
--
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel Open Source Technology Center
Patrick Stinson
2018-11-04 03:54:42 UTC
Permalink
Woah. Any idea what this is all about?
Post by Thiago Macieira
Post by Patrick Stinson
The output of dumpbin /symbols /linenumbers Qt5Core.lib shows these symbols
as protected, not public as referenced above
That is correct. They are protected.
Search your sources for a
#define protected public
Find it and remove it.
--
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel Open Source Technology Center
_______________________________________________
Interest mailing list
http://lists.qt-project.org/mailman/listinfo/interest
Thiago Macieira
2018-11-04 04:46:09 UTC
Permalink
Post by Patrick Stinson
Woah. Any idea what this is all about?
Someone's hack that clearly doesn't work.
--
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel Open Source Technology Center
Patrick Stinson
2018-11-04 05:45:50 UTC
Permalink
Looks like the only instances of that string are in tests. And only three. So that can’t be it.
Post by Patrick Stinson
Woah. Any idea what this is all about?
Post by Thiago Macieira
Post by Patrick Stinson
The output of dumpbin /symbols /linenumbers Qt5Core.lib shows these symbols
as protected, not public as referenced above
That is correct. They are protected.
Search your sources for a
#define protected public
Find it and remove it.
--
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel Open Source Technology Center
_______________________________________________
Interest mailing list
http://lists.qt-project.org/mailman/listinfo/interest
Alexandru Croitor
2018-11-06 08:51:02 UTC
Permalink
I haven't looked at the error messages, but I think

"#define protected public"

is used by PyQt5 / sip source code to allow overriding protected methods from Python derived classes.

I don't know if they have support for disabling it.
Post by Patrick Stinson
Looks like the only instances of that string are in tests. And only three. So that can’t be it.
Post by Patrick Stinson
Woah. Any idea what this is all about?
Post by Thiago Macieira
Post by Patrick Stinson
The output of dumpbin /symbols /linenumbers Qt5Core.lib shows these symbols
as protected, not public as referenced above
That is correct. They are protected.
Search your sources for a
#define protected public
Find it and remove it.
--
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel Open Source Technology Center
_______________________________________________
Interest mailing list
http://lists.qt-project.org/mailman/listinfo/interest
_______________________________________________
Interest mailing list
http://lists.qt-project.org/mailman/listinfo/interest
Thiago Macieira
2018-11-06 15:29:07 UTC
Permalink
Post by Alexandru Croitor
"#define protected public"
is used by PyQt5 / sip source code to allow overriding protected methods
from Python derived classes.
That hack doesn't work with MSVC. It results in the exact error messages
during linking that you see in the OP.
--
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel Open Source Technology Center
Patrick Stinson
2018-11-06 15:42:06 UTC
Permalink
The project linked OK without it, so well see how it goes once I fox this plethora of other problems actually getting it running.
Post by Alexandru Croitor
I haven't looked at the error messages, but I think
"#define protected public"
is used by PyQt5 / sip source code to allow overriding protected methods from Python derived classes.
I don't know if they have support for disabling it.
Post by Patrick Stinson
Looks like the only instances of that string are in tests. And only three. So that can’t be it.
Post by Patrick Stinson
Woah. Any idea what this is all about?
Post by Thiago Macieira
Post by Patrick Stinson
The output of dumpbin /symbols /linenumbers Qt5Core.lib shows these symbols
as protected, not public as referenced above
That is correct. They are protected.
Search your sources for a
#define protected public
Find it and remove it.
--
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel Open Source Technology Center
_______________________________________________
Interest mailing list
http://lists.qt-project.org/mailman/listinfo/interest
_______________________________________________
Interest mailing list
http://lists.qt-project.org/mailman/listinfo/interest
Loading...