I wrote a C++ application inclunding the external libraries glpk and boost with a binding to the Matlab API. On Ubuntu compiling in Matlab using mex works fine, the program is running without difficulties.
Now to use the same application on a Windows Platform I wanted to cross-compile it, using Mingw64. Corresponding to this thread it can be done with the following command:
x86_64-w64-mingw32-gcc -m64 -shared -I"/usr/local/MATLAB/R2011a/extern/include" -I"/usr/local/include" -I"/usr/include" -DMATLAB_MEX_FILE -o output.mexw64 input.cpp -L"/usr/local/MATLAB/R2011a/bin/glnxa64/" -lmex -lmx -lmat -leng -L"/usr/lib" -lglpk
- Path /usr/local/include contains the header files for the boost library (header only library)
- Path /usr/include contains the header files for the glpk library
- Path /usr/lib contains the source files for the glpk library
But running this command gives me the error that there are conflicting declarations
of the type:
/usr/include/sys/types.h:110:19: error: conflicting declaration ‘typedef __ssize_t ssize_t’
/usr/lib/gcc/x86_64-w64-mingw32/4.6/../../../../x86_64-w64-mingw32/include/_mingw.h:394:35: error: ‘ssize_t’ has a previous declaration as ‘typedef long long int ssize_t’
It seems that the path /usr/include causes problem for the compiler. But it is needed to include the glpk header files. Any ideas to solve the problem?