QT App crashes directly after starting debug run
-
hi there..
First:
Plattform: Win11 Compiler: QT Mingw64 / MSys-MingW64 CMake: QT-Cmake / MSys-CMake
Following Situation:
I setup QT to use the Msys2 internal mingW64 g++ compiler, to Compile my Cmake Project.
I made a new Kit to handle that, by using msys64\mingw64\bin\gcc.exe as c-compiler and its g++.exe for c++.
For Cmake, i use my own D:\CMake\bin\cmake.exe, which is up to date. But it changes nothing if i use QT bundled..
As Debugger, i tried the QT Bundled and the msys dgb.exe.. no ChangeCmake - No Errors on Building and Linking
QT Compiling- No Errors, too.. finishes normallyBut when i try to Start the compiled App, it starts and crashes immediately after that..
The Log of Applications says (from german to english):14:19:32: Starte D:/...../Application.exe 14:19:32: The program crashed. 14:19:32: The Process stopped 14:19:32: Starte D:/...../Application.exe crashed
I´ve no clue whats guing on.. Debug Logs, Error Logs.. everything is fine.. it just.. crashes...
Since i´m not even seeing a Window...
Here is my CMakeLists.txt:cmake_minimum_required(VERSION 3.5) project(Tester LANGUAGES CXX) set(TEST_PROJECT ${PROJECT_NAME}) project(TileGameStudio_Editor LANGUAGES CXX) set(EDITOR_PROJECT ${PROJECT_NAME}) set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_INCLUDE_CURRENT_DIR ON) #=============================================================== Fetch GoogleTest include(FetchContent) FetchContent_Declare( googletest URL https://github.com/google/googletest/archive/e2239ee6043f73722e7aa812a459f54a28552929.zip ) # For Windows set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) FetchContent_MakeAvailable(googletest) #=============================================================== Setup CMake for QT set(CMAKE_AUTOUIC ON) set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) #=============================================================== Setup Paths list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") set(PROJ_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src) set(PROJ_INC ${CMAKE_CURRENT_SOURCE_DIR}/include) set(PROJ_LIBS ${CMAKE_CURRENT_SOURCE_DIR}/libs ${CMAKE_CURRENT_SOURCE_DIR}) set(PROJ_TESTS ${CMAKE_CURRENT_SOURCE_DIR}/tests) set(PROJ_TST ${CMAKE_CURRENT_SOURCE_DIR}/test) set(PROJ_UI ${CMAKE_CURRENT_SOURCE_DIR}/ui) list(APPEND CMAKE_AUTOUIC_SEARCH_PATHS ${PROJ_UI}) set(ANGLE_INCLUDE_PATH "D:/angle/include") set(ANGLE_LIBRARY_PATH ${PROJ_LIBS}) #=============================================================== Add Runtime Paths set(RT_SRC ${CMAKE_CURRENT_SOURCE_DIR}/../TileGameStudio_Runtime/src) set(RT_INC ${CMAKE_CURRENT_SOURCE_DIR}/../TileGameStudio_Runtime/include) #=============================================================== Include Packages set (CMAKE_PREFIX_PATH "D:/Qt/5.15.2/mingw81_64/") find_package(QT NAMES Qt5 COMPONENTS Widgets REQUIRED) find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core REQUIRED) find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Widgets REQUIRED) find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Gui REQUIRED) find_package(Qt${QT_VERSION_MAJOR} COMPONENTS OpenGL REQUIRED) include(FindSDL2) find_package(SDL2 REQUIRED) set(FREETYPE_INCLUDE_DIRS D:/freetype/include) set(FREETYPE_INCLUDE_DIR_ft2build D:/freetype/include) set(FREETYPE_LIBRARY D:/freetype/obj) find_package(Freetype REQUIRED) set(LUA_INCLUDE_DIR D:/luajit/src) set(LUA_LIBRARY D:/luajit) find_package(LuaJIT REQUIRED) find_package(OGG REQUIRED) find_package(FLAC REQUIRED) find_package(Vorbis REQUIRED) find_package(THEORA REQUIRED) find_package(OpenSSL REQUIRED) set(Boost_DEBUG ON) set(BOOST_ROOT D:/boost) set(Boost_COMPILER "-mgw11") set(Boost_ARCHITECTURE "-x64") find_package(Boost COMPONENTS filesystem json REQUIRED) #=============================================================== OUTPUT <LIB>_FOUND if (NOT PKG_CONFIG_FOUND) message(STATUS "PKG-CONFIG: NO") else () message(STATUS "PKG-CONFIG: YES - under: ${PKG_CONFIG_EXECUTABLE} >> used to find packages") endif () if (NOT SDL2_FOUND) message(STATUS "SDL2: NO") else () message(STATUS "SDL2: YES - under: ${SDL2_INCLUDE_DIR} >> included and linked") include_directories( ${SDL2_INCLUDE_DIR}) link_directories( ${SDL2_INCLUDE_DIR}) endif () if (NOT FREETYPE_FOUND) message(STATUS "freetype2: NO") else () message(STATUS "freetype2: YES - under: ${FREETYPE_INCLUDE_DIR_ft2build} >> included and linked") include_directories(${FREETYPE_INCLUDE_DIR_ft2build}) link_directories(${FREETYPE_INCLUDE_DIR_ft2build}) endif () if (NOT LUAJIT_FOUND) message(STATUS "LuaJit: NO") else () message(STATUS "LuaJit: YES - under: ${LUA_INCLUDE_DIR} >> included and linked") include_directories(${LUA_INCLUDE_DIR}) link_directories(${LUA_INCLUDE_DIR}) endif () if (NOT OGG_FOUND) message(STATUS "OGG: NO") else () message(STATUS "OGG: YES: Version ${OGG_VERSION} - under: ${OGG_INCLUDE_DIR} >> included and linked") include_directories(${OGG_INCLUDE_DIR}) link_directories(${OGG_INCLUDE_DIR}) endif () if (NOT FLAC_FOUND) message(STATUS "FLAC: NO") else () message(STATUS "FLAC: YES - under: ${FLAC_INCLUDE_DIR} >> included and linked") include_directories(${FLAC_INCLUDE_DIR}) link_directories(${FLAC_INCLUDE_DIR}) endif () if (NOT VORBIS_FOUND) message(STATUS "VORBIS: NO") else () message(STATUS "VORBIS: YES - under: ${VORBIS_INCLUDE_DIR} >> included and linked") include_directories(${VORBIS_INCLUDE_DIR}) link_directories(${VORBIS_INCLUDE_DIR}) endif () if (NOT THEORA_FOUND) message(STATUS "THEORA: NO") else () message(STATUS "THEORA: YES - under: ${THEORA_INCLUDE_DIR} >> included and linked") include_directories(${THEORA_INCLUDE_DIR}) link_directories(${THEORA_INCLUDE_DIR}) endif () if (NOT OPENSSL_FOUND) message(STATUS "OpenSSL: NO") else () message(STATUS "OpenSSL: YES - under: ${OPENSSL_INCLUDE_DIR} >> included and linked") include_directories(${OPENSSL_INCLUDE_DIR}) link_directories(${OPENSSL_INCLUDE_DIR}) endif () if (NOT BOOST_FOUND) message(STATUS "Boost: NO") else () message(STATUS "Boost: YES - under: ${Boost_INCLUDE_DIRS} >> included and linked") include_directories(${Boost_INCLUDE_DIRS} ${Boost_LIBRARY_DIRS}) link_directories(${Boost_INCLUDE_DIRS} ${Boost_LIBRARY_DIRS}) endif () #=============================================================== Include Directories include_directories( ${PROJ_LIBS} ${PROJ_INC} ${PROJ_SRC} ${PROJ_UI} ${RT_SRC} ${RT_INC} ${ANGLE_INCLUDE_PATH} ${ANGLE_LIBRARY_PATH} "${PROJECT_SOURCE_DIR}/../TileGameStudio_Editor_Build_Debug/Shipped/Data/InitProj/shaders" gtest/ ) link_directories ( ${PROJ_LIBS} ${PROJ_INC} ${PROJ_SRC} ${PROJ_UI} ${RT_SRC} ${RT_INC} ${ANGLE_INCLUDE_PATH} ${ANGLE_LIBRARY_PATH} "${PROJECT_SOURCE_DIR}/../TileGameStudio_Editor_Build_Debug/Shipped/Data/InitProj/shaders" gtest/ ) #=============================================================== Find GLES Libraries message("Looking for GLES Libraries") SET(CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".dll" ".dll.lib") find_library(D3D_Lib NAMES d3dcompiler_47 PATHS ${PROJ_LIBS} REQUIRED) find_library(GLES2_Lib NAMES libGLESv2 PATHS ${PROJ_LIBS} REQUIRED) message("Done: Looking for GLES Libraries") #=============================================================== Find GTest and GMock Libraries #find_library(GTEST_LIBRARIES NAMES libgtest_main libgtest libgmock libgmock_main REQUIRED) #=============================================================== Collect Sources, Hearders and UI file(GLOB PROJECT_SOURCES CONFIGURE_DEPENDS ${PROJ_SRC}/*.cpp ${RT_SRC}/*.cpp ${RT_SRC}/src_ObjectClasses/*.cpp ) file(GLOB PROJECT_HEADERS CONFIGURE_DEPENDS ${PROJ_INC}/*.h ${RT_INC}/include_ObjectClasses/*.h ) file(GLOB PROJECT_TESTS CONFIGURE_DEPENDS ${PROJ_TESTS}/*.cpp ) file(GLOB PROJECT_UI CONFIGURE_DEPENDS ${PROJ_UI}/*.ui ) file(GLOB PROJECT_RES CONFIGURE_DEPENDS ${PROJ_SRC}/*.qrc ) file(GLOB PROJECT_SHADERS CONFIGURE_DEPENDS "${PROJECT_SOURCE_DIR}/../TileGameStudio_Editor_Build_Debug/Shipped/Data/InitProj/shaders/*.glsl" ) #=============================================================== Build App set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../TileGameStudio_Editor_Build_Debug/Shipped/") set(APP_ICON_RESOURCE_WINDOWS "${CMAKE_CURRENT_SOURCE_DIR}/res.rc") if(${QT_VERSION_MAJOR} GREATER_EQUAL 6) qt_add_executable(${EDITOR_PROJECT} ${PROJECT_SOURCES} ${PROJECT_HEADERS} ${PROJECT_UI} ${PROJECT_RES} ${APP_ICON_RESOURCE_WINDOWS} ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp ) else() if(ANDROID) add_library(${EDITOR_PROJECT} SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS} ${PROJECT_UI} ${PROJECT_RES} ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp ) elseif(WIN32) add_executable(${EDITOR_PROJECT} ${PROJECT_SOURCES} ${PROJECT_HEADERS} ${PROJECT_UI} ${PROJECT_RES} ${APP_ICON_RESOURCE_WINDOWS} ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp ) else() add_executable(${EDITOR_PROJECT} ${PROJECT_SOURCES} ${PROJECT_HEADERS} ${PROJECT_UI} ${PROJECT_RES} ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp ) endif() endif() set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../TileGameStudio_Editor_Build_Debug/Shipped/Tests") add_executable(${TEST_PROJECT} ${PROJECT_SOURCES} ${PROJECT_HEADERS} ${PROJECT_TESTS} ) set_target_properties(${TEST_PROJECT} PROPERTIES OUTPUT_NAME "Tests") #=============================================================== Link Libraries target_link_libraries(${EDITOR_PROJECT} PRIVATE Qt${QT_VERSION_MAJOR}::Core PRIVATE Qt${QT_VERSION_MAJOR}::Widgets PRIVATE Qt${QT_VERSION_MAJOR}::Gui PRIVATE Qt${QT_VERSION_MAJOR}::OpenGL ${SDL2_LIBRARY} ${LUA_LIBRARY} ${GLES2_Lib} ${D3D_Lib} ${OGG_LIBRARY} ${FLAC_LIBRARY} ${VORBIS_LIBRARY} ${THEORA_LIBRARY} ${OPENSSL_CRYPTO_LIBRARY} ${Boost_LIBRARIES} ${Boost_FILESYSTEM_LIBRARY} ) target_link_libraries(${TEST_PROJECT} PRIVATE Qt${QT_VERSION_MAJOR}::Core PRIVATE Qt${QT_VERSION_MAJOR}::Widgets PRIVATE Qt${QT_VERSION_MAJOR}::Gui PRIVATE Qt${QT_VERSION_MAJOR}::OpenGL ${SDL2_LIBRARY} ${LUA_LIBRARY} ${GLES2_Lib} ${D3D_Lib} ${OGG_LIBRARY} ${FLAC_LIBRARY} ${VORBIS_LIBRARY} ${THEORA_LIBRARY} ${OPENSSL_LIBRARIES} ${Boost_LIBRARIES} ${Boost_FILESYSTEM_LIBRARY} gtest_main ) enable_testing() include(GoogleTest) #=============================================================== Add GoogleTests message("") message("Adding Tests to ${TEST_PROJECT}") message("") if(NOT PROJECT_TESTS) message("No Tests available!") else() gtest_add_tests(TARGET ${TEST_PROJECT} TEST_LIST var) message("Tests were added to ${TEST_PROJECT}. The List:") foreach(X ${var}) message("- ${X}") endforeach() endif() message("")
My main.cpp is simply the QT default one, created on project creation.. no change right now..
-
@BDC_Patrick
You run your application from within each debugger, it crashes, but the debuggers don't tell you anything about it? I take it that if you place a breakpoint on entry to yourmain()
you never get there? -
@BDC_Patrick might be a driver/win11 issue, does it also directly crash with a console application?