undefined reference to `_imp__PathRemoveFileSpecW@4'

  • The error I'm having trying to compile a Qt 4.8.6 GUI program on Windows is...

    undefined reference to `_imp__PathRemoveFileSpecW@4'

    This should be resolved by adding lshlwapi, however that already defined at the link below.


    I've been tinkering with the pro file with no luck. I'm running qmake with the above linked pro file as follows.

    qmake "USE_QRCODE=1" "USE_UPNP=1" "USE_IPV6=1" kryptkoin-qt.pro

    When checking the command line I cannot see lshlwapi in there.

    g++ -Wl,--large-address-aware -static -static-libgcc -static-libstdc++ -Wl,-s -mthreads -Wl,-subsystem,windows -o release\KryptKoin-qt.exe object_script.KryptKoin-qt.Release  -L"c:\Qt\4.8.6\lib" -lmingwthrd -lmingw32 -lqtmain build\bitcoin-qt_res.o -lqrencode -LC:/deps/miniupnpc -lminiupnpc -liphlpapi -lmswsock -LC:/deps/boost_1_57_0/stage/lib -LC:/deps/db-4.8.30.NC/build_unix -LC:/deps/openssl-1.0.1u -LC:/deps/qrencode-3.4.4/.libs -lssl -lcrypto -ldb_cxx -lboost_system-mgw49-mt-s-1_57 -lboost_filesystem-mgw49-mt-s-1_57 -lboost_program_options-mgw49-mt-s-1_57 -lboost_thread-mgw49-mt-s-1_57 -lboost_chrono-mgw49-mt-s-1_57 -lQtGui -lgdi32 -lcomdlg32 -loleaut32 -limm32 -lwinmm -lwinspool -lmsimg32 -lQtCore -lole32 -luuid -lws2_32 -ladvapi32 -lshell32 -luser32 -lkernel32

    This is the following error.

    ./build\guiutil.o:guiutil.cpp:(.text+0x13d4): undefined reference to `_imp__PathRemoveFileSpecW@4'
    collect2.exe: error: ld returned 1 exit status

    I downloaded and built the Qt 4.8.6 as follows.
    Downloaded from: http://download.qt-project.org/official_releases/qt/4.8/4.8.6/qt-everywhere-opensource-src-4.8.6.zip

    configure -release -opensource -confirm-license -static -no-sql-sqlite -no-qt3support -no-opengl -qt-zlib -no-gif -qt-libpng -qt-libmng -no-libtiff -qt-libjpeg -no-dsp -no-vcproj -no-openssl -no-dbus -no-phonon -no-phonon-backend -no-multimedia -no-audio-backend -no-webkit -no-script -no-scripttools -no-declarative -no-declarative-debug -qt-style-windows -qt-style-windowsxp -qt-style-windowsvista -no-style-plastique -no-style-cleanlooks -no-style-motif -no-style-cde -nomake demos -nomake examples

    Any help would be appreciated, I've spent hours on this and have made zero progress.

  • Lifetime Qt Champion


    Why Qt 4 ? It has reached End Of Life. If you're locked to it then please you the latest version available which is 4.8.7.

    Also, why build it yourself ? There are pre-built packages.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.