sys/times.h Compiling issue
Show older comments
Hello
I was trying to compile a mex file and I got the following error
>> mex -setup
MEX configured to use 'MinGW64 Compiler (C)' for C language compilation.
To choose a different language, select one from the following:
mex -setup C++
mex -setup FORTRAN
>> compileSparseCoLO
Compiling Libraries...Building with 'MinGW64 Compiler (C++)'.
Error using mex
In file included from
C:\Users\Abd-PC\Downloads\SparseCoLO112\SparseCoLO112\mex\ccputime.cpp:26:0:
C:\Users\Abd-PC\Downloads\SparseCoLO112\SparseCoLO112\mex\ccputime.h:28:23: fatal error:
sys/times.h: No such file or directory
#include <sys/times.h>
^
compilation terminated.
Error in compileSparseCoLO (line 81)
eval(command);
I'm not sure where is the problem and how to solve it. I would appreiate your help.
13 Comments
Abdelrahman Aldik
on 31 Aug 2021
Walter Roberson
on 31 Aug 2021
The code has a <> style #include. <> style #include does not look in the current directory, only on the include path. If the files are not stored in one of the standard include paths, then you will need to use the mex -I option to indicate the directory that has the sys folder inside it -- even if that is your project directory itself. For example,
mex -I. other arguments
the -I. means to treat . (current directory) as part of the include path -- base directories from which to try to find sys/times.h
Abdelrahman Aldik
on 31 Aug 2021
Abdelrahman Aldik
on 31 Aug 2021
Abdelrahman Aldik
on 1 Sep 2021
Walter Roberson
on 2 Sep 2021
Edited: Walter Roberson
on 2 Sep 2021
compileSparseCoLO is a script. Edit in, and look near line 55 or so, where you will see an if/elseif series that starts with
if strcmp(computer, 'GLNXA64') && (MLVer(1) > 7 || (MLVer(1) == 7&& MLVer(2) > 2))
In the case of Windows, you need to find the "else" branch of that, which looks like
else % Mac, Windows or Solaris
which is then followed by
MexFlags = ' -O ';
Change that line to
MexFlags = ' -O -I"C:\Users\Abd-PC\Downloads\SparseCoLO112\SparseCoLO112"';
Abdelrahman Aldik
on 2 Sep 2021
Walter Roberson
on 2 Sep 2021
You probably also need to add -L and -l (lower-case L) options . -L to name the location to search for a DLL, and -l naming the DLL to search for (which would be the DLL containing the compiled implementation of times)
Abdelrahman Aldik
on 4 Sep 2021
Walter Roberson
on 4 Sep 2021
Although it is not ideal, you would change
MexFlags = ' -O -I"C:\Users\Abd-PC\Downloads\SparseCoLO112\SparseCoLO112"';
to
MexFlags = ' -O -I"C:\Users\Abd-PC\Downloads\SparseCoLO112\SparseCoLO112" -L"C:\Users\Abd-PC\Downloads\SparseCoLO112\SparseCoLO112\sys" -ltime';
but possibly what you would need is
MexFlags = ' -O -I"C:\Users\Abd-PC\Downloads\SparseCoLO112\SparseCoLO112" "C:\Users\Abd-PC\Downloads\SparseCoLO112\SparseCoLO112\sys\time.obj"';
Abdelrahman Aldik
on 7 Sep 2021
Abdelrahman Aldik
on 8 Sep 2021
Answers (0)
Categories
Find more on MATLAB Support for MinGW-w64 C/C++ Compiler in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!