I static compiled Qt5.14.0 with the MinGW compiler in windows using the following guide:
After compiling qt, projects created with qmake are static compiled without any errors. But projects defined as cmake give the following errors:
qcoreapplication_win.cpp:-1: error: undefined reference to `GetFileVersionInfoSizeW@8'
qcoreapplication_win.cpp:-1: error: undefined reference to `GetFileVersionInfoW@16'
qcoreapplication_win.cpp:-1: error: undefined reference to `VerQueryValueW@16'
qglobal.cpp:-1: error: undefined reference to `_imp__WSACleanup@0'
qglobal.cpp:-1: error: undefined reference to `_imp__WSAStartup@8'
qglobal.cpp:-1: error: undefined reference to `_imp__WSACleanup@0'
CMakeLists.txt
cmake_minimum_required(VERSION 3.5)
project(untitled27 LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(Qt5Core)
add_executable(untitled27
main.cpp
)
target_link_libraries(untitled27 Qt5::Core)
main.cpp
#include <QCoreApplication>
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
return a.exec();
}