現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
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!エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の 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 (한국어)