Qt 5.11.3 works fine, but Qt 5.12.1 throws LINKER errors
-
I double-checked to make sure nothing is missed:
Qt_5_12_0_MSVC2017_64bit-Debug
links fine and application runs :)Qt_5_12_0_MSVC2017_64bit-Release
links fine and application runs :)Qt_5_12_1_MSVC2017_64bit-Debug
throws:
main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl NetLibrary::registerNetLibraryQML(void)" (_imp?registerNetLibraryQML@NetLibrary@@YAXXZ) referenced in function main
Qt_5_12_1_MSVC2017_64bit-Release
throws:
main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl NetLibrary::registerNetLibraryQML(void)" (_imp?registerNetLibraryQML@NetLibrary@@YAXXZ) referenced in function main
Also, here is the dumpbin for
netlib.lib
onQt_5_12_0_MSVC2017_64bit-Debug
which links fine and works nice:C:\Users\me\repos\build-application-Desktop_Qt_5_12_0_MSVC2017_64bit-Debug\netlib\debug>dumpbin /linkermember netlib.lib Microsoft (R) COFF/PE Dumper Version 14.15.26730.0 Copyright (C) Microsoft Corporation. All rights reserved. Dump of file netlib.lib File Type: LIBRARY Archive member name at 8: / FFFFFFFF time/date uid gid 0 mode C3D size correct header end 69 public symbols 190A __IMPORT_DESCRIPTOR_netlib 1B30 __NULL_IMPORT_DESCRIPTOR 1C66 netlib_NULL_THUNK_DATA 2878 ?registerNetLibraryQML@NetLibrary@@YAXXZ 2878 __imp_?registerNetLibraryQML@NetLibrary@@YAXXZ 2E0C ?tr@Netlib@@SA?AVQString@@PEBD0H@Z 2E0C __imp_?tr@Netlib@@SA?AVQString@@PEBD0H@Z 2E8A ?trUtf8@Netlib@@SA?AVQString@@PEBD0H@Z 2E8A __imp_?trUtf8@Netlib@@SA?AVQString@@PEBD0H@Z 1DBE ??0Netlib@@QEAA@XZ 1DBE __imp_??0Netlib@@QEAA@XZ 1E2C ??1Netlib@@UEAA@XZ 1E2C __imp_??1Netlib@@UEAA@XZ 1F06 ?agentDiscover@Netlib@@QEAAXXZ 1F06 __imp_?agentDiscover@Netlib@@QEAAXXZ 1FFA ?agentSlice@Netlib@@QEAA_NAEBVQUrl@@AEBVQString@@V3@222@Z 1FFA __imp_?agentSlice@Netlib@@QEAA_NAEBVQUrl@@AEBVQString@@V3@222@Z 210E ?discoveryInProgress@Netlib@@QEBA_NXZ 210E __imp_?discoveryInProgress@Netlib@@QEBA_NXZ 28FC ?setDiscoveryInProgress@Netlib@@QEAAX_N@Z 28FC __imp_?setDiscoveryInProgress@Netlib@@QEAAX_N@Z 2C7E ?slicingInProgress@Netlib@@QEBA_NXZ 2C7E __imp_?slicingInProgress@Netlib@@QEBA_NXZ 2A82 ?setSlicingInProgress@Netlib@@QEAAX_N@Z 2A82 __imp_?setSlicingInProgress@Netlib@@QEAAX_N@Z 2530 ?layerID@Netlib@@QEBA?AVQString@@XZ 2530 __imp_?layerID@Netlib@@QEBA?AVQString@@XZ 2982 ?setLayerID@Netlib@@QEAAXVQString@@@Z 2982 __imp_?setLayerID@Netlib@@QEAAXVQString@@@Z 2B82 ?slicingDone@Netlib@@QEBA_NXZ 2B82 __imp_?slicingDone@Netlib@@QEBA_NXZ 2A04 ?setSlicingDone@Netlib@@QEAAX_N@Z 2A04 __imp_?setSlicingDone@Netlib@@QEAAX_N@Z 24BE ?init@Netlib@@AEAAXXZ 24BE __imp_?init@Netlib@@AEAAXXZ 22AA ?getOsName@Netlib@@AEAA?AVQString@@XZ 22AA __imp_?getOsName@Netlib@@AEAA?AVQString@@XZ 2090 ?discoveryFinished@Netlib@@AEAAXXZ 2090 __imp_?discoveryFinished@Netlib@@AEAAXXZ 2B06 ?slicerFinished@Netlib@@AEAAXXZ 2B06 __imp_?slicerFinished@Netlib@@AEAAXXZ 1F80 ?agentLogReady@Netlib@@AEAAXXZ 1F80 __imp_?agentLogReady@Netlib@@AEAAXXZ 2430 ?handleSlicingInProgressChanged@Netlib@@AEAAX_N@Z 2430 __imp_?handleSlicingInProgressChanged@Netlib@@AEAAX_N@Z 232C ?getSlicerProgress@Netlib@@AEAAXXZ 232C __imp_?getSlicerProgress@Netlib@@AEAAXXZ 23AA ?getSlicerProgressFinished@Netlib@@AEAAXXZ 23AA __imp_?getSlicerProgressFinished@Netlib@@AEAAXXZ 1E9A __imp_??_7Netlib@@6B@ 2636 ?metaObject@Netlib@@UEBAPEBUQMetaObject@@XZ 2636 __imp_?metaObject@Netlib@@UEBAPEBUQMetaObject@@XZ 2752 ?qt_metacast@Netlib@@UEAAPEAXPEBD@Z 2752 __imp_?qt_metacast@Netlib@@UEAAPEAXPEBD@Z 26BE ?qt_metacall@Netlib@@UEAAHW4Call@QMetaObject@@HPEAPEAX@Z 26BE __imp_?qt_metacall@Netlib@@UEAAHW4Call@QMetaObject@@HPEAPEAX@Z 27D2 ?qt_static_metacall@Netlib@@CAXPEAVQObject@@W4Call@QMetaObject@@HPEAPEAX@Z 27D2 __imp_?qt_static_metacall@Netlib@@CAXPEAVQObject@@W4Call@QMetaObject@@HPEAPEAX@Z 2190 ?discoveryInProgressChanged@Netlib@@QEAAX_N@Z 2190 __imp_?discoveryInProgressChanged@Netlib@@QEAAX_N@Z 221A ?discoveryResultChanged@Netlib@@QEAAXVQJsonArray@@@Z 221A __imp_?discoveryResultChanged@Netlib@@QEAAXVQJsonArray@@@Z 2CFE ?slicingInProgressChanged@Netlib@@QEAAX_N@Z 2CFE __imp_?slicingInProgressChanged@Netlib@@QEAAX_N@Z 25B0 ?layerIDChanged@Netlib@@QEAAXVQString@@@Z 25B0 __imp_?layerIDChanged@Netlib@@QEAAXVQString@@@Z 2BFC ?slicingDoneChanged@Netlib@@QEAAX_N@Z 2BFC __imp_?slicingDoneChanged@Netlib@@QEAAX_N@Z 2D86 __imp_?staticMetaObject@Netlib@@2UQMetaObject@@B Archive member name at C82: / FFFFFFFF time/date uid gid 0 mode C4B size correct header end 37 offsets 1 190A 2 1B30 3 1C66 4 2878 5 2E0C 6 2E8A 7 1DBE 8 1E2C 9 1F06 A 1FFA B 210E C 28FC D 2C7E E 2A82 F 2530 10 2982 11 2B82 12 2A04 13 24BE 14 22AA 15 2090 16 2B06 17 1F80 18 2430 19 232C 1A 23AA 1B 1E9A 1C 2636 1D 2752 1E 26BE 1F 27D2 20 2190 21 221A 22 2CFE 23 25B0 24 2BFC 25 2D86 69 public symbols 7 ??0Netlib@@QEAA@XZ 8 ??1Netlib@@UEAA@XZ 9 ?agentDiscover@Netlib@@QEAAXXZ 17 ?agentLogReady@Netlib@@AEAAXXZ A ?agentSlice@Netlib@@QEAA_NAEBVQUrl@@AEBVQString@@V3@222@Z 15 ?discoveryFinished@Netlib@@AEAAXXZ B ?discoveryInProgress@Netlib@@QEBA_NXZ 20 ?discoveryInProgressChanged@Netlib@@QEAAX_N@Z 21 ?discoveryResultChanged@Netlib@@QEAAXVQJsonArray@@@Z 14 ?getOsName@Netlib@@AEAA?AVQString@@XZ 19 ?getSlicerProgress@Netlib@@AEAAXXZ 1A ?getSlicerProgressFinished@Netlib@@AEAAXXZ 18 ?handleSlicingInProgressChanged@Netlib@@AEAAX_N@Z 13 ?init@Netlib@@AEAAXXZ F ?layerID@Netlib@@QEBA?AVQString@@XZ 23 ?layerIDChanged@Netlib@@QEAAXVQString@@@Z 1C ?metaObject@Netlib@@UEBAPEBUQMetaObject@@XZ 1E ?qt_metacall@Netlib@@UEAAHW4Call@QMetaObject@@HPEAPEAX@Z 1D ?qt_metacast@Netlib@@UEAAPEAXPEBD@Z 1F ?qt_static_metacall@Netlib@@CAXPEAVQObject@@W4Call@QMetaObject@@HPEAPEAX@Z 4 ?registerNetLibraryQML@NetLibrary@@YAXXZ C ?setDiscoveryInProgress@Netlib@@QEAAX_N@Z 10 ?setLayerID@Netlib@@QEAAXVQString@@@Z 12 ?setSlicingDone@Netlib@@QEAAX_N@Z E ?setSlicingInProgress@Netlib@@QEAAX_N@Z 16 ?slicerFinished@Netlib@@AEAAXXZ 11 ?slicingDone@Netlib@@QEBA_NXZ 24 ?slicingDoneChanged@Netlib@@QEAAX_N@Z D ?slicingInProgress@Netlib@@QEBA_NXZ 22 ?slicingInProgressChanged@Netlib@@QEAAX_N@Z 5 ?tr@Netlib@@SA?AVQString@@PEBD0H@Z 6 ?trUtf8@Netlib@@SA?AVQString@@PEBD0H@Z 1 __IMPORT_DESCRIPTOR_netlib 2 __NULL_IMPORT_DESCRIPTOR 7 __imp_??0Netlib@@QEAA@XZ 8 __imp_??1Netlib@@UEAA@XZ 1B __imp_??_7Netlib@@6B@ 9 __imp_?agentDiscover@Netlib@@QEAAXXZ 17 __imp_?agentLogReady@Netlib@@AEAAXXZ A __imp_?agentSlice@Netlib@@QEAA_NAEBVQUrl@@AEBVQString@@V3@222@Z 15 __imp_?discoveryFinished@Netlib@@AEAAXXZ B __imp_?discoveryInProgress@Netlib@@QEBA_NXZ 20 __imp_?discoveryInProgressChanged@Netlib@@QEAAX_N@Z 21 __imp_?discoveryResultChanged@Netlib@@QEAAXVQJsonArray@@@Z 14 __imp_?getOsName@Netlib@@AEAA?AVQString@@XZ 19 __imp_?getSlicerProgress@Netlib@@AEAAXXZ 1A __imp_?getSlicerProgressFinished@Netlib@@AEAAXXZ 18 __imp_?handleSlicingInProgressChanged@Netlib@@AEAAX_N@Z 13 __imp_?init@Netlib@@AEAAXXZ F __imp_?layerID@Netlib@@QEBA?AVQString@@XZ 23 __imp_?layerIDChanged@Netlib@@QEAAXVQString@@@Z 1C __imp_?metaObject@Netlib@@UEBAPEBUQMetaObject@@XZ 1E __imp_?qt_metacall@Netlib@@UEAAHW4Call@QMetaObject@@HPEAPEAX@Z 1D __imp_?qt_metacast@Netlib@@UEAAPEAXPEBD@Z 1F __imp_?qt_static_metacall@Netlib@@CAXPEAVQObject@@W4Call@QMetaObject@@HPEAPEAX@Z 4 __imp_?registerNetLibraryQML@NetLibrary@@YAXXZ C __imp_?setDiscoveryInProgress@Netlib@@QEAAX_N@Z 10 __imp_?setLayerID@Netlib@@QEAAXVQString@@@Z 12 __imp_?setSlicingDone@Netlib@@QEAAX_N@Z E __imp_?setSlicingInProgress@Netlib@@QEAAX_N@Z 16 __imp_?slicerFinished@Netlib@@AEAAXXZ 11 __imp_?slicingDone@Netlib@@QEBA_NXZ 24 __imp_?slicingDoneChanged@Netlib@@QEAAX_N@Z D __imp_?slicingInProgress@Netlib@@QEBA_NXZ 22 __imp_?slicingInProgressChanged@Netlib@@QEAAX_N@Z 25 __imp_?staticMetaObject@Netlib@@2UQMetaObject@@B 5 __imp_?tr@Netlib@@SA?AVQString@@PEBD0H@Z 6 __imp_?trUtf8@Netlib@@SA?AVQString@@PEBD0H@Z 3 netlib_NULL_THUNK_DATA Summary C0 .debug$S 14 .idata$2 14 .idata$3 8 .idata$4 8 .idata$5 C .idata$6
-
Hi, the dumpbin for 5.12.1 is identical to 5.12.0. Seems netlib.lib is the innocent guy here. So it must be the client program, i.e. your main.cpp, perhaps some kind of visibility problem. We're running out of options so I'm thinking you could try renaming your library to something less generic/vanilla (there are many other libraries called netlib.xxx out there, perhaps one of them has snuck into in 5.12.1)
So say instead of netlib you could call it m3gnetlib (prefixing with half of your username).
That would mean changing the .pro file, the .h and .cpp files and also the #define from NETLIBSHARED_EXPORT to M3GNETLIBSHARED_EXPORT.I remember running into similar inexplicable issues in the past, and renaming the files helped (sometimes :-)
-
In 5.12.1, default Windows library paths (e.g., Windows Kits) were added to the search path in qmake's makefile generator, but were added before the user-specified paths instead of after. There's already a commit to fix this and should be in 5.12.3. See this bugreport
-
Thanks @mchinand!
In Qt 5.12.1 @m3g1dd 's netlib.lib gets muscled out by the big wheels at Microsoft, when I do a dir of the Windows Kits on my C: indeed there's a netlib.lib there. And that's what the linker tries to link with.
So either as I mentioned above go do that renaming, or wait for 5.12.3.
-
Hi, Thanks! Problem got resolved by renaming the
netlib
library tonetagentlib
, and Qt 5.12.1 builds and runs the application without any issue.These are all my code changes to rename the library:
On my netlib library project file i.e.
netlib.pro
file I changed:-TARGET = netlib +TARGET = netagentlib
Also, on my application executable project
*.pro
file I replaced these lines:win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../netlib/release/ -lnetlib else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../netlib/debug/ -lnetlib else:unix: LIBS += -L$$OUT_PWD/../netlib/ -lnetlib
with these lines:
win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../netlib/release/ -lnetagentlib else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../netlib/debug/ -lnetagentlib else:unix: LIBS += -L$$OUT_PWD/../netlib/ -lnetagentlib