I’m working on a collaborative project and the guy who controls the master branch of the project works on a mac. Because of this, there are a few minor differences in his makefile that don’t translate well to me on Windows. I use MinGW to hold my libraries, and compile using g++.
Makefile (as I thought it should go)
bomb: source/Level.cpp source/Level.h source/main.cpp
g++ -o bomb source/Level.cpp source/main.cpp -Wall -I. -I\MinGW\include\SDL -lSDLmain -lSDL -lSDL_image
The Makefile that works for him:
bomb: source/Level.cpp source/Level.h source/main.cpp
g++ -o bomb source/Level.cpp source/main.cpp -Wall -I. -I/Library/Frameworks/SDL.framework/Headers -lSDLmain -lSDL -lSDL_image -framework
My include files for the SDL library are at “C:\MinGW\include\SDL”. Using that knowledge, how would I correctly write the makefile? As a side note, the error I get when using my current makefile is:
C:\MinGW\msys\1.0\src\mingwrt/../mingw/main.c:73: undefined reference to 'WinMain@16'
Have you tried adding
-lmingw32to the end of the libraries list? And do you have aint main(int argc, char** argv)function defined somewhere? Also, see the SDL FAQ