Link SDL samples under cygwin with GDC

Fauvel Wilfried wilfried.fauvel at laposte.net
Sat Jul 1 12:13:18 PDT 2006


Hi all,

I am trying to build SDL samples under cygwin with GDC compiler,
I 'm using SDL and opengl found on http://shinh.skr.jp/d/porting.html (both
copied in the root directory of my project in /SDL and /opengl),
and I try to use the following Makefile :

CC = gdc

INCLUDES = -ISDL -Iopengl
LDFLAGS_GL=  -lopengl32 -lglu32
LDFLAGS_SDL= -lSDL -lSDL_d

LIBRARIES = -L. -L/sw/lib  -LSDL -Lopengl

all:
     $(CC) testgl.d -c $(INCLUDES)
     $(CC) testgl.o $(LIBRARIES) $(LDFLAGS_GL) $(LDFLAGS_SDL)  -o test.exe
     $(CC) testbitmap.d -c $(INCLUDES)
     $(CC) testbitmap.o $(LIBRARIES) $(LDFLAGS_GL) $(LDFLAGS_SDL)  -o
testbitmap.exe
     $(CC) picture.d -c $(INCLUDES)
     $(CC) picture.o $(LIBRARIES) $(LDFLAGS_GL) $(LDFLAGS_SDL)  -o
picture.exe

If I don't add opengl32.dll in the same directory of opengl32.lib, testgl.o
couldn't be linked (It seems opengl like is missing), and it crash during
SDL initialisation when I try to run.

testbitmap.d and picture.d doesn't like at all :

gdc
testbitmap.o -L. -L/sw/lib  -LSDL -Lopengl -lopengl32 -lglu32 -lSDL -lSDL_d
-o testbitmap.exe
testbitmap.o:testbitmap.d:(.text+0x67c): undefined reference to
`__D7picture12picture_bitsAh'
collect2: ld returned 1 exit status
make: *** [all] Error 1

gdc
icture.o -L. -L/sw/lib  -LSDL -Lopengl -lopengl32 -lglu32 -lSDL -lSDL_d  -o
picture.exe
/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../libgphobos.a(cmain.o):cmain.d:(.t
ext+0x1a): undefined reference to `__Dmain'
collect2: ld returned 1 exit status
make: *** [all] Error 1

Is there any way to solve my linking problems ?

Thanks for your answers.







More information about the D.gnu mailing list