How do I keep my Qt C++ program from opening a console in Windows?

后端 未结 5 2005
有刺的猬
有刺的猬 2021-02-19 10:10

I\'m making an application in Qt Creator, with cmake and MinGW as compiler. I\'ve seen this question being answered for other people, but they used regular Qt projects with .pro

5条回答
  •  情话喂你
    2021-02-19 11:02

    I had the same issue, but solved it by adding:

    #CMakeLists.txt
    # ... some text (like finding QT)
    
    LINK_LIBRARIES(${QT_QTMAIN_LIBRARY})
    
    # ... and then
    
    ADD_EXECUTABLE(my_qt_project WIN32 ... )
    

    If I don't use LINK_LIBRARIES(${QT_QTMAIN_LIBRARY}) I get error:

    error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup

提交回复
热议问题