linker error using wxwidgets with cmake
I'm getting following linker error when I compile my program with VS2008 solution which is created with CMake for my wxwidgets based application.
error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup
but I'm able to compile the same program with a normal VS2008 solution which is not created with CMake.
cmakelists.txt
file contents:
cmake_minimum_required(VERSION 2.8)
SET(CMAKE_DEBUG_POSTFIX "d")
ADD_DEFINITIONS(-DOSG_DEBUG_POSTFIX="${CMAKE_DEBUG_POSTFIX}")
SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
SET(LIBRARY_OUTPUT_PATH开发者_如何学Python ${CMAKE_BINARY_DIR}/bin)
SET(ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
SET(RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(BOOST_ROOT "E:/boost_1_38_0")
FIND_PACKAGE( Boost 1.38.0 REQUIRED unit_test_framework )
SET(wxWidgets_ROOT_DIR "E:/wxWidgets-2.9.0")
find_package(wxWidgets COMPONENTS aui html adv core xml base REQUIRED)
INCLUDE(${wxWidgets_USE_FILE})
ADD_EXECUTABLE(browser
BrowserApp.cpp
BrowserApp.h
BrowserMain.cpp
BrowserMain.h
)
TARGET_LINK_LIBRARIES(browser
common
${wxWidgets_LIBRARIES}
)
I'm trying to make my application run across platforms using CMake build system.
Any help is appreciated.
Do you need to make it a Win32 executable by using the following add_executable
line?
add_executable(browser WIN32 BrowserApp.cpp BrowserApp.h BrowserMain.cpp BrowserMain.h)
Also, if you're using a reasonably recent CMake, you don't have to use ALL_CAPS_EVERYWHERE
anymore.
精彩评论