Question

I have been using Visual Studio 2012 for a Qt/C++ project.

I am trying to migrate over to MinGW so that I can use C++11 entirely instead of the partial support that MSFT's compiler offers. Using CMake to generate the project and making was proceeding very well, compiling all the subprojects and the main project itself.

However, the linking is giving me some errors and I'm not sure how to resolve them:

Linking CXX executable Owl.exe CMakeFiles\Owl.dir/objects.a(BoardTreeView.cpp.obj):BoardTreeView.cpp:(.text+0x1e): undefined reference to __imp__ZN9QTreeViewC2EP7QWidget' CMakeFiles\Owl.dir/objects.a(BoardTreeView.cpp.obj):BoardTreeView.cpp:(.text+0x7b): undefined reference to_imp_ZN9QTreeViewD2Ev' CMakeFiles\Owl.dir/objects.a(BoardTreeView.cpp.obj):BoardTreeView.cpp:(.text+0x116): undefined reference to __imp__ZNK17QAbstractItemView5modelEv' CMakeFiles\Owl.dir/objects.a(BoardTreeView.cpp.obj):BoardTreeView.cpp:(.text+0x1a1): undefined reference to _imp_ZNK18QStandardItemModel9findItemsERK7QString6QFlagsIN2Qt9MatchFlagEEi' CMakeFiles\Owl.dir/objects.a(BoardTreeView.cpp.obj):BoardTreeView.cpp:(.text+0x303): undefined reference to __imp__ZN8QVariantD1Ev' CMakeFiles\Owl.dir/objects.a(BoardTreeView.cpp.obj):BoardTreeView.cpp:(.text+0x350): undefined reference to_imp_ZeqRK7QStringS1_' CMakeFiles\Owl.dir/objects.a(BoardTreeView.cpp.obj):BoardTreeView.cpp:(.text+0x53e): undefined reference to __imp__ZN8QVariantD1Ev' CMakeFiles\Owl.dir/objects.a(BoardTreeView.cpp.obj):BoardTreeView.cpp:(.text+0x649): undefined reference to _imp_ZNK9QTreeView10indexBelowERK11QModelIndex' CMakeFiles\Owl.dir/objects.a(BoardTreeView.cpp.obj):BoardTreeView.cpp:(.text+0x669): undefined reference to __imp__ZNK17QAbstractItemView5modelEv' CMakeFiles\Owl.dir/objects.a(BoardTreeView.cpp.obj):BoardTreeView.cpp:(.text+0x6b1): undefined reference to _imp_ZN17QAbstractItemView15setCurrentIndexERK11QModelIndex' CMakeFiles\Owl.dir/objects.a(BoardTreeView.cpp.obj):BoardTreeView.cpp:(.text+0x6c1): undefined reference to __imp__ZN8QVariantD1Ev' CMakeFiles\Owl.dir/objects.a(BoardTreeView.cpp.obj):BoardTreeView.cpp:(.text+0x6d6): undefined reference to_imp_ZN8QVariantD1Ev' c:/progra~1/mingw-~1/x64-48~1.1-p/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.8.1/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\Owl.dir/objects.a(BoardTreeView.cpp.obj): bad reloc address 0xf in section `.text$_ZNSt9exceptionC2Ev[_ZNSt9exceptionC2Ev]' collect2.exe: error: ld returned 1 exit status Deltas\CMakeFiles\Owl.dir\build.make:1217: recipe for target 'Deltas/Owl.exe' failed mingw32-make[2]: * [Deltas/Owl.exe] Error 1 CMakeFiles\Makefile2:435: recipe for target 'Deltas/CMakeFiles/Owl.dir/all' failed mingw32-make[1]: [Deltas/CMakeFiles/Owl.dir/all] Error 2 Makefile:115: recipe for target 'all' failed mingw32-make: ** [all] Error 2

The project compiles and links just fine using Visual Studio (and Xcode, FWIW), so I'm not sure what the linker is missing.

Can anyone offer any suggestions?

Was it helpful?

Solution

You need to download Qt for MinGW (or build it yourself, if you're using a different version of MinGW than the version the Qt release was built with.) The VS version of Qt cannot be used with MinGW.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top