Hey guys!
First of all, thanks a lot for helping me through all this time, you all rock!
Now though, I'm trying to port my game library from Linux to Windows but it's been a small pain-in-the-you-know-what :/ for instance, here's the Linux makefile:
Code:
CFLAGS=-I. -I/usr/include/freetype2
all: main
main:
g++ $(CFLAGS) -c -o core.o lib/core.cpp
g++ $(CFLAGS) -c -o 3dmath.o lib/3dmath.cpp
g++ $(CFLAGS) -c -o audio.o lib/audio.cpp
g++ $(CFLAGS) -c -o camera.o lib/camera.cpp
g++ $(CFLAGS) -c -o sprite.o lib/sprite.cpp
g++ $(CFLAGS) -c -o freetype.o lib/freetype.cpp
g++ $(CFLAGS) -c -o fps.o lib/fps.cpp
g++ $(CFLAGS) -c -o collision.o lib/collision.cpp
ld -o libgp2d.so core.o camera.o 3dmath.o sprite.o freetype.o fps.o audio.o collision.o -shared
rm *.o
clean:
rm *.o
rm libgp2d.so
And here's the Windows one (that I had to hack around with lots of googling):
Code:
CFLAGS=-I.
all: main
main:
g++ $(CFLAGS) -c -o core.o lib/core.cpp
g++ $(CFLAGS) -c -o 3dmath.o lib/3dmath.cpp
g++ $(CFLAGS) -c -o audio.o lib/audio.cpp
g++ $(CFLAGS) -c -o camera.o lib/camera.cpp
g++ $(CFLAGS) -c -o sprite.o lib/sprite.cpp
g++ $(CFLAGS) -c -o freetype.o lib/freetype.cpp
g++ $(CFLAGS) -c -o fps.o lib/fps.cpp
g++ $(CFLAGS) -c -o collision.o lib/collision.cpp
# ar rcs libgp2d.a core.o camera.o 3dmath.o sprite.o freetype.o fps.o audio.o collision.o
g++ -Wl -o libgp2d.so core.o camera.o 3dmath.o sprite.o freetype.o fps.o audio.o collision.o -lmingw32 -lSDL -lSDL_image -lSDL_mixer -lopengl32 -lfreetype -mwindows -lwinmm
del *.o
clean:
del *.o
del libgp2d.so
The commented line is the one that works, I get the .a file, but it doesn't get recognized when I compile my game itself... it throws something like this:
Code:
C:\SVN\iteam>make -f Makefile.win
g++ -o iteam.exe iteam.cpp functions.cpp players.cpp -Bdynamic -I. -L. -I/usr/include/freetype2 -L/lib -lGP2D -lfreetype -lSDL -lSDL_mixer -lSDL_image -lope
ngl -lglu32 -lmingw32 -mwindows
In file included from iteam.cpp:1:
globals.h:24: error: expected init-declarator before "FNTCounter"
globals.h:24: error: expected `,' or `;' before "FNTCounter"
globals.h:25: error: expected init-declarator before "FNTNames"
globals.h:25: error: expected `,' or `;' before "FNTNames"
globals.h:26: error: expected init-declarator before "FNTGameGUI"
globals.h:26: error: expected `,' or `;' before "FNTGameGUI"
iteam.cpp:18: error: expected constructor, destructor, or type conversion before "iteam"
iteam.cpp:18: error: expected `,' or `;' before "iteam"
iteam.cpp:19: error: expected constructor, destructor, or type conversion before "iteam"
iteam.cpp:19: error: expected `,' or `;' before "iteam"
iteam.cpp:20: error: expected constructor, destructor, or type conversion before "iteam"
iteam.cpp:20: error: expected `,' or `;' before "iteam"
In file included from functions.cpp:1:
globals.h:24: error: expected init-declarator before "FNTCounter"
globals.h:24: error: expected `,' or `;' before "FNTCounter"
globals.h:25: error: expected init-declarator before "FNTNames"
globals.h:25: error: expected `,' or `;' before "FNTNames"
globals.h:26: error: expected init-declarator before "FNTGameGUI"
globals.h:26: error: expected `,' or `;' before "FNTGameGUI"
functions.cpp: In function `int iteam::Load()':
functions.cpp:29: error: `FNTCounter' undeclared (first use this function)
functions.cpp:29: error: (Each undeclared identifier is reported only once for each function it appears in.)
functions.cpp:30: error: `FNTNames' undeclared (first use this function)
functions.cpp:31: error: `FNTGameGUI' undeclared (first use this function)
functions.cpp: In function `void iteam::DrawGUI()':
functions.cpp:83: error: `FNTGameGUI' undeclared (first use this function)
functions.cpp:83: error: `Text' undeclared (first use this function)
In file included from players.cpp:1:
globals.h:24: error: expected init-declarator before "FNTCounter"
globals.h:24: error: expected `,' or `;' before "FNTCounter"
globals.h:25: error: expected init-declarator before "FNTNames"
globals.h:25: error: expected `,' or `;' before "FNTNames"
globals.h:26: error: expected init-declarator before "FNTGameGUI"
globals.h:26: error: expected `,' or `;' before "FNTGameGUI"
players.cpp: In member function `void iteam::PlayerObj::DrawName()':
players.cpp:23: error: `FNTNames' undeclared (first use this function)
players.cpp:23: error: (Each undeclared identifier is reported only once for each function it appears in.)
players.cpp:23: error: `Text' undeclared (first use this function)
make: *** [main] Error 1
C:\SVN\iteam>
So... either I get that... or with the g++ line in the Makefile, I get this:
Code:
C:\SVN\gp2d>make -f Makefile.win
g++ -I. -c -o core.o lib/core.cpp
g++ -I. -c -o 3dmath.o lib/3dmath.cpp
g++ -I. -c -o audio.o lib/audio.cpp
g++ -I. -c -o camera.o lib/camera.cpp
g++ -I. -c -o sprite.o lib/sprite.cpp
g++ -I. -c -o freetype.o lib/freetype.cpp
g++ -I. -c -o fps.o lib/fps.cpp
g++ -I. -c -o collision.o lib/collision.cpp
g++ -shared -Wl -o libgp2d.so core.o camera.o 3dmath.o sprite.o freetype.o fps.o audio.o collision.o -lmingw32 -lSDL -lSDL_image -lSDL_mixer -lopengl32 -lfr
eetype -mwindows -lwinmm
Cannot export ⌂SDL_image_NULL_THUNK_DATA: symbol not found
Cannot export ⌂SDL_mixer_NULL_THUNK_DATA: symbol not found
collect2: ld returned 1 exit status
make: *** [main] Error 1
C:\SVN\gp2d>
If I remove the -shared parameter, I get this:
Code:
C:\SVN\gp2d>make -f Makefile.win
g++ -I. -c -o core.o lib/core.cpp
g++ -I. -c -o 3dmath.o lib/3dmath.cpp
g++ -I. -c -o audio.o lib/audio.cpp
g++ -I. -c -o camera.o lib/camera.cpp
g++ -I. -c -o sprite.o lib/sprite.cpp
g++ -I. -c -o freetype.o lib/freetype.cpp
g++ -I. -c -o fps.o lib/fps.cpp
g++ -I. -c -o collision.o lib/collision.cpp
g++ -Wl -o libgp2d.so core.o camera.o 3dmath.o sprite.o freetype.o fps.o audio.o collision.o -lmingw32 -lSDL -lSDL_image -lSDL_mixer -lopengl32 -lfreetype -
mwindows -lwinmm
/mingw/lib/libmingw32.a(main.o):main.c:(.text+0x106): undefined reference to `WinMain@16'
collect2: ld returned 1 exit status
make: *** [main] Error 1
C:\SVN\gp2d>
Which is unlogical because the library has no need for a main sentence (not that I know of) because it has worked perfectly in Linux without one.
If anybody could lend me a hand here it would be GREATLY appreciated!
- DARKGuy