Closed CharlosNels closed 1 month ago
Bot detected the issue body's language is not English, translate it automatically.
Title: The main function cannot be found when compiling the project
应该是 libsdl 的问题,加上 SDL_MAIN_HANDLED
就行
https://github.com/xmake-io/xmake-repo/blob/a1a5ca1ff583456ed9519703bdcdf00ce3fa2c0b/packages/l/libsdl/xmake.lua#L249-L255
Bot detected the issue body's language is not English, translate it automatically.
It should be a problem with libsdl, just add
SDL_MAIN_HANDLED
https://github.com/xmake-io/xmake-repo/blob/a1a5ca1ff583456ed9519703bdcdf00ce3fa2c0b/packages/l/libsdl/xmake.lua#L249-L255
有用,Thanks♪(・ω・)ノ
Bot detected the issue body's language is not English, translate it automatically.
Useful, Thanks♪(・ω・)ノ
Xmake 版本
xmake v2.9.4 has been installed!
操作系统版本和架构
Windows 10 19045
描述问题
编译项目时找不到主函数,main.cpp里有主函数,而且相同的配置linux下就可以编译通过。
期待的结果
修复错误
工程配置
add_rules("mode.debug", "mode.release") set_policy("package.requires_lock", true)
add_requires("imgui 1.89", {configs = {sdl2=true, opengl2=true, freetype=true}}) add_requires("libintl") add_requires("cserialport") add_requires("libsdl") add_requires("opengl") add_requires("spdlog") add_requires("boost", {configs = {headers=true}})
target("DebugMyProtocol_IMGUI") set_kind("binary") add_packages("imgui", "libintl", "cserialport", "libsdl", "opengl", "spdlog", "boost") add_files("src/*.cpp")
附加信息和错误日志
error: 正在创建库 build\windows\x64\release\DebugMyProtocol_IMGUI.lib 和对象 build\windows\x64\release\DebugMyProtocol_IMGUI.exp LINK : fatal error LNK1561: 必须定义入口点