이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
sys/times.h Compiling issue
조회 수: 11 (최근 30일)
이전 댓글 표시
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
Abdelrahman Aldik
2021년 8월 31일
I have created the sys file as well as the three h files and I have put them in the same directory as my project. Still, I got the same error.
Walter Roberson
2021년 8월 31일
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
2021년 8월 31일
I executed
>> mex -I. -setup C++
MEX configured to use 'MinGW64 Compiler (C++)' for C++ language compilation.
>> compileSparseCoLO
and still got the same error. What should I do?
Abdelrahman Aldik
2021년 8월 31일
I also have tried:
>> mex -I.(C:\Users\Abd-PC\Downloads\SparseCoLO112\SparseCoLO112\sys) -setup C++
MEX configured to use 'MinGW64 Compiler (C++)' for C++ language compilation.
>> compileSparseCoLO
and still, got the same error!
Walter Roberson
2021년 9월 2일
편집: Walter Roberson
2021년 9월 2일
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
2021년 9월 2일
Thanks alot for your reply. I managed to avoid tis error but I got the following error instead
>> 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
MEX configured to use 'MinGW64 Compiler (C++)' for C++ language compilation.
>> compileSparseCoLO
Compiling Libraries...Building with 'MinGW64 Compiler (C++)'.
MEX completed successfully.
done
Compiling mexForestConvert.cpp...Building with 'MinGW64 Compiler (C)'.
Error using mex
Cannot export mexFunction: symbol not defined
ccputime.obj:ccputime.cpp:(.text+0xd): undefined reference to `times(tms*)'
ccputime.obj:ccputime.cpp:(.text+0x3d): undefined reference to `gettimeofday(timeval*,
void*)'
collect2.exe: error: ld returned 1 exit status
Error in compileSparseCoLO (line 93)
eval(command);
Walter Roberson
2021년 9월 2일
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
2021년 9월 4일
Where should I add those? I would really appreaited if you can elaborate on that.
Walter Roberson
2021년 9월 4일
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
2021년 9월 7일
Upon usng this line:
MexFlags = ' -O -I"C:\Users\Abd-PC\Downloads\SparseCoLO112\SparseCoLO112" -L"C:\Users\Abd-PC\Downloads\SparseCoLO112\SparseCoLO112\sys" -ltime';
I have received the following error
>> compileSparseCoLO
Current directory is = C:\Users\Abd-PC\Downloads\SparseCoLO112\SparseCoLO112\mex
Cannot find sub-directory "mex"
Execute this script at the top directory of SparseCoLO
>> compileSparseCoLO
Compiling Libraries...Error using mex
MEX cannot find library 'time', specified with the -l option.
MEX searched for a file with one of the following names:
libtime.a
time.lib
libtime.lib
Verify the library name is correct. If the library is not
on the existing path, specify the path with the -L option.
Error in compileSparseCoLO (line 81)
eval(command);
And upon using this line
MexFlags = ' -O -I"C:\Users\Abd-PC\Downloads\SparseCoLO112\SparseCoLO112" "C:\Users\Abd-PC\Downloads\SparseCoLO112\SparseCoLO112\sys\time.obj"';
I received this following error
>> compileSparseCoLO
Compiling Libraries...Building with 'MinGW64 Compiler (C++)'.
MEX completed successfully.
done
Compiling mexForestConvert.cpp...Error using mex
C:\Users\Abd-PC\Downloads\SparseCoLO112\SparseCoLO112\mex\"C:\Users\Abd-PC\Downloads\SparseCoLO112\SparseCoLO112\sys\time.obj"mexForestConvert.cpp
not found; check that you are in the correct current folder, and check the spelling of
'C:\Users\Abd-PC\Downloads\SparseCoLO112\SparseCoLO112\mex\"C:\Users\Abd-PC\Downloads\SparseCoLO112\SparseCoLO112\sys\time.obj"mexForestConvert.cpp'.
Error in compileSparseCoLO (line 93)
eval(command);
I'm not sure what to do next?
Abdelrahman Aldik
2021년 9월 8일
I have installed Microsoft Visual C++ 2019 and used it to compile the mex file, I got the following error
>> compileSparseCoLO
Compiling Libraries...Building with 'MinGW64 Compiler (C++)'.
MEX completed successfully.
done
Compiling mexForestConvert.cpp...Building with 'Microsoft Visual C++ 2019 (C)'.
Error using mex
LINK : error LNK2001: unresolved external symbol mexFunction
ccputime.lib : fatal error LNK1120: 1 unresolved externals
I would appreciate your help.
답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom(English)
아시아 태평양
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)