cannot build mex files using MinGW

I have configured MinGW using mex -setup but cannot seem to succesfully build files. I am using Matlab R2018a with Windows 10.
Trying:
mex('-R2018a','-O', 'CFLAGS="\$CFLAGS -fopenmp"', '-O','LDFLAGS="\$LDFLAGS
-fopenmp"',[path,'private/get_from_3D_projection_mex.cpp'], '-output', [path,
'private/get_from_3D_projection_mex'])
and I get an error:
Error using mex
g++: error: \-fexceptions: No such file or directory
Trying this solution did not work for me https://github.com/cjlin1/libsvm/issues/55
mex('-R2018a','-O', 'COMPFLAGS="\$COMPFLAGS -fopenmp"', '-O','LDFLAGS="\$LDFLAGS
-fopenmp"',[path,'private/get_from_3D_projection_mex.cpp'], '-output', [path,
'private/get_from_3D_projection_mex'])
Then I have:
Error using mex
D:\matl\cSAXS_matlab_base_package\+utils\private\get_from_3D_projection_mex.cpp:76:25: fatal error:
sys/sysinfo.h: No such file or directory
#include <sys/sysinfo.h>
Also trying to build it with VS 2015 I get the latter error...
Any ideas? thanks in advance!

2 comentarios

Walter Roberson
Walter Roberson el 31 de Mzo. de 2022
I do not know why you have those two \ in the mex call.
Toni Uusimäki
Toni Uusimäki el 31 de Mzo. de 2022
This is how it was written when I downloaded the files. I get the same error with and without them...

Iniciar sesión para comentar.

Respuestas (1)

Toni Uusimäki
Toni Uusimäki el 1 de Abr. de 2022
Seems these files were written for Linux.
I commented out the line
#include <sys/sysinfo.h>
in all the mex cpp files.
Then included line
#include <windows.h>
also used the mex call
mex('-R2018a','-O', 'COMPFLAGS="$COMPFLAGS -fopenmp"', '-O','LDFLAGS="$LDFLAGS
-fopenmp"',[path,'private/get_from_3D_projection_mex.cpp'], '-output', [path,
'private/get_from_3D_projection_mex'])
with CFLAGS changed to COMPFLAGS and without the \ characters.

Etiquetas

Preguntada:

el 31 de Mzo. de 2022

Respondida:

el 1 de Abr. de 2022

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by