c++ - Qt5 cmake Windows Linker Error -
i wanted start new project uses qt in combination cmake. (hope i) followed docs, seems if linker not doing work correctly:
cmakefiles\qttest.dir/objects.a(main.cpp.obj): in function `qstring::qstring(char const*)': p:/qt/5.9.1/msvc2015_64/include/qtcore/qstring.h:659: undefined reference `__imp__zn7qstring16fromascii_helperepkci' cmakefiles\qttest.dir/objects.a(main.cpp.obj): in function `qtypedarraydata<unsigned short>::deallocate(qarraydata*)': p:/qt/5.9.1/msvc2015_64/include/qtcore/qarraydata.h:237: undefined reference `__imp__zn10qarraydata10deallocateeps_yy'
i'm using mingw-w64 (the x86_64 installation) clion , bundled cmake , qt 5.9.1. cmakelists.txt looks this:
cmake_minimum_required(version 3.8) project(qttest) set(cmake_cxx_standard 14) set(cmake_module_path ${project_source_dir}) set(cmake_verbose_makefile on) # qt set(cmake_include_current_dir on) set(cmake_automoc on) set(qt5_no_link_qtmain on) set(cmake_prefix_path p:/qt/5.9.1/msvc2015_64/lib/cmake) find_package(qt5core required) get_target_property(qtcore_location qt5::core location) message("qtcore version ${qt5core_version} @ ${qtcore_location}") # qttest executable set(source_files main.cpp) add_executable(qttest ${source_files}) target_link_libraries(qttest qt5::core)
when creating build files outputs (correctly) qtcore version 5.9.1 @ p:/qt/5.9.1/msvc2015_64/bin/qt5core.dll
main.cpp contains call qstring testing purposes:
#include <qtcore/qstring> int main() { qstring string = qstring("test"); }
why happen?
wiki
Comments
Post a Comment