Compiling C++ file to *.mex64 leads to "unresolved external symbol" (conversion from size_t to int most likely the reason"
1 回表示 (過去 30 日間)
古いコメントを表示
I have an old C++ source code which was successfully compiled to *.mex32 years ago (with MSVC8.0). With the help of the old optionsfile and the example file MSVC90OPTS.BAT I managed to write a new options file for 64-bit and the MSVC 9.0 compiler.
During the compilation process there are several warnings: warning C4267: '=' : conversion from 'size_t' to 'int', possible loss of data
And at the end the error message: filename.obj : error LNK2019: unresolved external symbol "float * * _cdecl Subfunction::filename(char *,struct std::pair<int,int> *,int,unsigned _int64 &,float &,float &)" (?_filename@Subfunction@@YAPEAPEAMPEADPEAU?$pair@HH@std@@HAEA_KAEAM3@Z) referenced in function mexFunction filename.mexw64 : fatal error LNK1120: 1 unresolved externals
From previous answers I learned, that the size_t to int causes troubles in 64 bit systems only.
There might be already a solution mentioned in http://www.mathworks.de/matlabcentral/answers/41063-matlab-coder-and-the-uint64-size_t
But as I am neither used to C or C++ I do not really know what to do.
Any more detailed suggestions?!
THANKS
0 件のコメント
回答 (1 件)
José-Luis
2012 年 12 月 6 日
編集済み: José-Luis
2012 年 12 月 6 日
From your error message, the program not working has nothing to do with the conversion from size_t to int. That in itself might make your program run funny, especially since size_t is unsigned. You will have problems with large and negative integers. You should avoid that even in 32 bits. But that is just a warning: you could ignore it, but in this case it's probably a bad idea.
Your program is refusing to run because of an unresolved external function:
float * * _cdecl Subfunction::filename(char *,struct std::pair<int,int> *,int,unsigned _int64 &,float &,float &)
I can only speculate as to why the function is unresolved. You might be linking to the wrong library or, and judging from the rest of your message I would guess that is the problem, you might be linking to a 32 bit library and trying to compile a 64 bit app. That's a no-no.
参考
カテゴリ
Help Center および File Exchange で MATLAB Compiler についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!