Important: Please read the Qt Code of Conduct -

Error building QT5.14.2 mingw-x64 gcc 9.3.0

  • Using: configure.bat -prefix "C:\Qt\5.14.2\mingw93_64" -platform win32-g++ -c++std c++17 -developer-build -shared -release -ltcg -optimize-size -gui -widgets -opensource -confirm-license -make libs -nomake tools -nomake examples -nomake tests -skip webengine

    It hits qtbase/src/tools/moc and errors on this line:

    g++ -Wl,-s -Wl,-subsystem,console -fno-keep-inline-dllexport -Os -std=c++1z -fno-exceptions -flto -Wl,--gc-sections -o ..\..\..\bin\moc.exe .obj/release/moc.o .obj/release/preprocessor.o .obj/release/generator.o .obj/release/parser.o .obj/release/token.o .obj/release/main.o D:\Build\QT5\mingw93_64\qtbase\lib\libQt5Bootstrap.a -luser32 -lole32 -ladvapi32 -lshell32 -lnetapi32 -luuid -lz .obj\release\moc_resource_res.o

    c:/dev/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\kev\AppData\Local\Temp\moc.exe.8f0AoO.ltrans0.ltrans.o:<artificial>:(.text+0x627): undefined reference to QVarLengthArray<unsigned short, 256>::QVarLengthArray(int) [clone .lto_priv.1] [clone .lto_priv.0]' ... many more of the same ... C:\Users\kev\AppData\Local\Temp\moc.exe.8f0AoO.ltrans6.ltrans.o:<artificial>:(.text+0x4e05): undefined reference toEnumDef::EnumDef(EnumDef const&) [clone .lto_priv.0] [clone .lto_priv.0]'

    collect2.exe: error: ld returned 1 exit status

    edit: and if I explicitly told it not to build tools, why is it building moc?

  • Lifetime Qt Champion

    @txCodeMonkey said in Error building QT5.14.2 mingw-x64 gcc 9.3.0:

    why is it building moc?

    Because you activated gui/widgets and moc is needed to use these modules.

Log in to reply