2015-10-19 92 views
0

我沒有看到我的主要問題在哪裏。我看到很多帖子,我不知道我的錯誤在哪裏。我知道這是主要的問題。我試圖清理和重建(qmake -projectqmake),但它仍然不起作用。用Qt和C-Lion未定義引用'WinMain @ 16'

int main(int ac, char *av[]) { 
    QApplication app(ac, av); 

    app.setOrganizationName("Zero"); 
    app.setApplicationName("Gomoku"); 

    IntroState *intro = new IntroState(); 
    if (intro->exec() != QDialog::Accepted) 
     return 1; 

    GameEngine engine; 
    engine.show(); 

    return app.exec(); 
} 

我的CMake的是:

cmake_minimum_required(VERSION 2.8) 
set(CMAKE_INCLUDE_CURRENT_DIR ON) 
project(Gomoku) 
set(SOURCE_FILES src/core/IntroState.cpp 
       src/core/GameEngine.cpp 
       src/core/Arbiter.cpp 
       src/tests/CoreFirstRuleTests.cpp) 
find_package(Qt5Widgets REQUIRED) 
include_directories(include/core 
     include/ai 
     include/graphic 
     include/tests 
     include) 
set(HW_HEADER_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include) 
include_directories(${HW_HEADER_DIR}) 
qt5_wrap_cpp(Gomoku_SRC ${HW_HEADER_DIR}/core/GameEngine.h 
     ${HW_HEADER_DIR}/core/IntroState.h) 
qt5_wrap_ui(Gomoku_UI 
     ${HW_HEADER_DIR}/ui/dialog.ui) 
add_executable(Gomoku ${SOURCE_FILES} ${Gomoku_SRC} ${Gomoku_UI}) 
qt5_use_modules(Gomoku Widgets) 
+1

你不使用Qt正確連接你的代碼。 –

+0

我沒有添加我的主CMake,我是白癡,謝謝。 –

回答

2

不要忘記添加主在編譯...

相關問題