I'm trying to get my program to talk to Mathematica using MathLink. I'm using cygwin, and mathematica 8.0.
I can compile the equivalent of the "AddTwo" program and use it successfully by using the x86_64-w64-mingw32-gcc.exe compiler (as installed with cygwin).
However, if I try to use gcc to do the compilation, I have a whole tonne of errors in mathlink.h. Here are the first few lines of what I get:
gcc -c -static-libgcc -I/cygdrive/c/Program\ Files/Wolfram\ Research/Mathematica/8.0/SystemFiles/Links/MathLink/DeveloperKit/Windows-x86-64/CompilerAdditions/mldev64/include talk.c
In file included from talk.c:1:0:
mathlink.h:996:1: error: expected ‘)’ before ‘*’ token
mathlink.h:997:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘MLDeviceMain’
The reason that I want to use gcc is that I want to use the gsl libraries in my code. I can use them easily enough with gcc, but I can't for the life of me figure out how to get the mingw compilers working with the gsl libraries. Here are the error messages I get from mingw with gsl:
"x86_64-w64-mingw32-gcc.exe" -o Loops.exe ./loops.o -L/usr/lib -lgsl -lgslcblas
/usr/lib/gcc/x86_64-w64-mingw32/4.5.3/../../../../x86_64-w64-mingw32/bin/ld: skipping incompatible /usr/lib/libgsl.dll.a when searching for -lgsl
/usr/lib/gcc/x86_64-w64-mingw32/4.5.3/../../../../x86_64-w64-mingw32/bin/ld: skipping incompatible /usr/lib/libgsl.a when searching for -lgsl
/usr/lib/gcc/x86_64-w64-mingw32/4.5.3/../../../../x86_64-w64-mingw32/bin/ld: skipping incompatible /usr/lib/libgsl.a when searching for -lgsl
/usr/lib/gcc/x86_64-w64-mingw32/4.5.3/../../../../x86_64-w64-mingw32/bin/ld: skipping incompatible /usr/lib/libgsl.dll.a when searching for -lgsl
/usr/lib/gcc/x86_64-w64-mingw32/4.5.3/../../../../x86_64-w64-mingw32/bin/ld: skipping incompatible /usr/lib/libgsl.a when searching for -lgsl
/usr/lib/gcc/x86_64-w64-mingw32/4.5.3/../../../../x86_64-w64-mingw32/bin/ld: cannot find -lgsl
/usr/lib/gcc/x86_64-w64-mingw32/4.5.3/../../../../x86_64-w64-mingw32/bin/ld: skipping incompatible /usr/lib/libgslcblas.dll.a when searching for -lgslcblas
/usr/lib/gcc/x86_64-w64-mingw32/4.5.3/../../../../x86_64-w64-mingw32/bin/ld: skipping incompatible /usr/lib/libgslcblas.a when searching for -lgslcblas
/usr/lib/gcc/x86_64-w64-mingw32/4.5.3/../../../../x86_64-w64-mingw32/bin/ld: skipping incompatible /usr/lib/libgslcblas.a when searching for -lgslcblas
/usr/lib/gcc/x86_64-w64-mingw32/4.5.3/../../../../x86_64-w64-mingw32/bin/ld: skipping incompatible /usr/lib/libgslcblas.dll.a when searching for -lgslcblas
/usr/lib/gcc/x86_64-w64-mingw32/4.5.3/../../../../x86_64-w64-mingw32/bin/ld: skipping incompatible /usr/lib/libgslcblas.a when searching for -lgslcblas
/usr/lib/gcc/x86_64-w64-mingw32/4.5.3/../../../../x86_64-w64-mingw32/bin/ld: cannot find -lgslcblas
Any assistance greatly appreciated (I know, I know, go to a *nix machine and everything will work... but I just can't afford another Mathematica license).