c++ - 使用 cygwin 编译 C++/SDL2/OpenGL 项目
问题描述
我正在尝试在 Windows 上编译一个通常在 MacOSX 上运行的项目。我有一个 makefile,我也想在 Windows 上使用它。问题是我不明白这个错误:
/usr/lib/gcc/x86_64-pc-cygwin/7.3.0/../../../../lib/libcygwin.a(libcmain.o): In function `main':
/usr/src/debug/cygwin-2.11.2-1/winsup/cygwin/lib/libcmain.c:37: undefined reference to `WinMain'
/usr/src/debug/cygwin-2.11.2-1/winsup/cygwin/lib/libcmain.c:37:(.text.startup+0x7f): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `WinMain'
collect2: error: ld returned 1 exit status
make: *** [makefile:70: program] Error 1
编译命令是:
g++ -o program path/to/a/lot/of/obj/obj.o -lGLEW -lGLU -lGL -lSDL2main -lSDL2
Cygwin 中有一个类似的主题Undefined reference to WinMain但该解决方案对我没有帮助。我的 makefile 在 MacOSX 上运行良好。
解决方案
推荐阅读
- java - 如何运行 akka grpc java 示例
- android - React Native - 从 android 内容 uri 获取文件名
- go - 从 ffmpeg image2pipe 保存连续的图像流
- react-native - 如何在 react-native 中编码字符串?
- python - 将列表项与对列表进行比较,并输出匹配对
- angular - NGRX 存储 - 服务器上的数据更改未应用于状态
- c# - 验证我收到的是否是整数
- reactjs - 赛普拉斯测试 - redux 商店是空的
- laravel - 从 Outlook 帐户获取电子邮件时出现“无消息”Imap Laravel 错误?
- c# - 在 Asp Net MVC 中排除来自 IdentityUser 的电子邮件