提问人:The new guy 提问时间:11/14/2023 更新时间:11/14/2023 访问量:27
我的 cmake 代码怎么了?它大约winmain@16
What happend with my cmake code? Its about winmain@16
问:
我按照互联网上的教程进行操作,但它不起作用!
cmake_minimum_required(VERSION 3.10)
set(SDL2_DIR "D:/environment/")
set(SDL2_INCLUDE_DIRS "${CMAKE_CURRENT_LIST_DIR}/include")
set(SDL2_LIB "D:/environment/SDL2/lib/x64/SDL2.lib")
set(SDL2_MAIN_LIB "D:/environment/SDL2/lib/x64/SDL2main.lib")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
project(SDL2Test)
find_package(SDL2 REQUIRED)
include_directories(${SDL2_INCLUDE_DIRS})
add_executable(SDL2Test Main.cpp)
set (SDL2_MAIN ON)
target_link_libraries(SDL2Test
${SDL2_MAIN_LIB}
${SDL2_LIB}
)
这是我使用make时的错误: c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../libmingw32.a(main.o):(.text.startup+0xc0):对“WinMain@16”的未定义引用
如何解决这个问题?我花了 3 天时间修复它。在此处输入图像描述
答: 暂无答案
评论
x64/