I tried and failed compiling Freglut 2.6.0-rc1 with Mingw.
The compilation is ok with Cygwin.
Then I tried "-mno-cygwin" compilation/linking mode. This flag switches Cygwin in Mingw mode (it uses /usr/include/mingw instead of Cygwin /usr/include). I've got some stranges warning, and a bunch of errors at linking.
I begin with what's working.
As configure did'nt work in both cases (Cygwin *and* Mingw), I've written my own Makefile.
Here it is:
============ BEGIN ===============
#Makefile forr Freeglut 2.6.0-rc and Cygwin
#Put it in "src" directory
#Create sub-directory "src/Gl", and put in it freeglut includes.
CFLAGS=-O2 -DTARGET_HOST_MS_WINDOWS -D__CYGWIN__ -DX_DISPLAY_MISSING -I./
LDFLAGS=-lopengl32 -lgdi32 -lwinmm
#For mingw mode, uncomment the line under.
gcc $(nocyg) $(objs) -shared $(LDFLAGS) -o $(outfile)
gcc $(nocyg) -c $(CFLAGS) $<
rm -f *.o $(outfile)
============= END = ===============
It works in Cygwin mode (no warnings) (but it needs cygwin1.dll for working)
Now, i uncomment "#nocyg=-mno-cygwin -mwindows"
Warnings at compilation:
freeglut_callbacks.c:293: warning: 'glutWindowStatusFunc' defined locally afterbeing referenced with dllimport linkage
freeglut_ext.c:218: warning: 'glutGetProcAddress' defined locally after being referenced with dllimport linkage
freeglut_window.c:1534: warning: 'glutFullScreenToggle' defined locally after being referenced with dllimport linkage
Ok, seems an issue with this macro:
# if defined(FREEGLUT_EXPORTS)
# define FGAPI __declspec(dllexport)
# define FGAPI __declspec(dllimport)
I didn't change anything, as i didn't know what i could have done.
Now, the linking park... i mean part:
freeglut_display.o:freeglut_display.c:(.text+0xb8): undefined reference to `__imp__glutGet@...'
freeglut_ext.o:freeglut_ext.c:(.text+0x68): undefined reference to `__imp__glutInit@...'
freeglut_ext.o:freeglut_ext.c:(.text+0xa9): undefined reference to `__imp__glutInitDisplayString@...'
freeglut_ext.o:freeglut_ext.c:(.text+0xd2): undefined reference to `__imp__glutInitDisplayMode@...'
freeglut_ext.o:freeglut_ext.c:(.text+0x106): undefined reference to `__imp__glutInitWindowSize@...'
freeglut_ext.o:freeglut_ext.c:(.text+0x111): undefined reference to `__imp__glutInitWindowPosition@...'
and i stop, as there are dozen lines like that.
It seems a problem with name decoration, right ?
Could someone look at my makefile ? Something is missing, for sure.
If it's not possible building DLL without "cygwin1.dll", please tell me how to make a static library (without "cygwin1.dll" dependance, if possible).