Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

macOS + qt5.12.5 + cmake: debug compiled program cannot run,objc[6076]: Class Q** is implemented in both



  • My development environment is: macOS Catalina + qt5.12.5 + cmake 3.16.5.
    My project's cmakelists.txt is :

    cmake_minimum_required(VERSION 3.5)
    
    project(untitled 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(Qt5 COMPONENTS Widgets REQUIRED)
    
    add_executable(untitled
      main.cpp
      mainwindow.cpp
      mainwindow.h
      mainwindow.ui
    )
    
    target_link_libraries(untitled PRIVATE Qt5::Widgets)
    

    I use release to compile and run the executable program, but debug compilation does not work, an error will be reported:

    22:58:37: Starting /Users/liq/Documents/myproj/qt-hmi/build-untitled-Desktop_Qt_5_12_5_clang_64bit-Debug/untitled ...
    objc[6076]: Class QMacAutoReleasePoolTracker is implemented in both /Users/liq/Qt5.12.5/5.12.5/clang_64/lib/QtCore.framework/Versions/5/QtCore (0x105585200) and /Users/liq/Qt5.12.5/5.12.5/clang_64/lib/QtCore.framework/Versions/5/QtCore_debug (0x10489ade8). One of the two will be used. Which one is undefined.
    objc[6076]: Class QT_ROOT_LEVEL_POOL__THESE_OBJECTS_WILL_BE_RELEASED_WHEN_QAPP_GOES_OUT_OF_SCOPE is implemented in both /Users/liq/Qt5.12.5/5.12.5/clang_64/lib/QtCore.framework/Versions/5/QtCore (0x105585278) and /Users/liq/Qt5.12.5/5.12.5/clang_64/lib/QtCore.framework/Versions/5/QtCore_debug (0x10489ae60). One of the two will be used. Which one is undefined.
    objc[6076]: Class KeyValueObserver is implemented in both /Users/liq/Qt5.12.5/5.12.5/clang_64/lib/QtCore.framework/Versions/5/QtCore (0x1055852a0) and /Users/liq/Qt5.12.5/5.12.5/clang_64/lib/QtCore.framework/Versions/5/QtCore_debug (0x10489ae88). One of the two will be used. Which one is undefined.
    objc[6076]: Class RunLoopModeTracker is implemented in both /Users/liq/Qt5.12.5/5.12.5/clang_64/lib/QtCore.framework/Versions/5/QtCore (0x1055852f0) and /Users/liq/Qt5.12.5/5.12.5/clang_64/lib/QtCore.framework/Versions/5/QtCore_debug (0x10489aed8). One of the two will be used. Which one is undefined.
    22:58:37: The process was ended forcefully.
    

    How to solve this problem?


  • Lifetime Qt Champion

    Hi,

    Looks like you have several versions of Qt installed. Do you have dependencies built with that other version ?



  • @SGaist I have qt4.8.7 and Qt5.12.5. My qmake is normal, only cmake debug has problems. what should I do?



  • @SGaist said in macOS + qt5.12.5 + cmake: debug compiled program cannot run,objc[6076]: Class Q** is implemented in both:

    Hi,

    Looks like you have several versions of Qt installed. Do you have dependencies built with that other version ?

    I solved this problem. Just delete the configuration file of QtCreator. The path of the file is:
    /Users/<username>/.config/QtProject/

    Restart QtCreator and everything works!


  • Lifetime Qt Champion

    Glad you found out and thanks for sharing !


Log in to reply