Mex: compiler not found problem
76 ビュー (過去 30 日間)
古いコメントを表示
I am messing around trying to learn how to call c++ code form matlab, specifically i am trying the code following this http://www.shawnlankton.com/2008/03/getting-started-with-mex-a-short-tutorial/ but i got stuck quite early, my code is:
% Setup compiler
mex -setup
%Open c++ file
%edit(['helloworld.cpp']);
% setup mex file
mex helloworld.cpp
but i get the following output (i pasted it all, error is the last part i guess). I tried looking at the path of the compuler but i dont know what i should be looking fore ?
Please choose your compiler for building external interface (MEX) files:
Would you like mex to locate installed compilers [y]/n? y
Select a compiler:
[1] Microsoft Visual C++ 2008 Express in C:\Program Files (x86)\Microsoft Visual Studio 9.0
[0] None
Compiler: 1
Please verify your choices:
Compiler: Microsoft Visual C++ 2008 Express
Location: C:\Program Files (x86)\Microsoft Visual Studio 9.0
Are these correct [y]/n? y
*****************************************************************************
Error: Could not find the 64-bit compiler. This may indicate that the
"X64 Compilers and Tools" or the Microsoft Windows Software
Development Kit (SDK) is not installed. To build 64-bit MEX-files
Microsoft Visual C++ 2008 Express Edition requires that these two
packages are installed properly.
*****************************************************************************
Trying to update options file: C:\Users\thor\AppData\Roaming\MathWorks\MATLAB\R2010a\mexopts.bat
From template: C:\PROGRA~1\MATLAB\R2010a\bin\win64\mexopts\msvc90freeopts.bat
Done . . .
**************************************************************************
Warning: The MATLAB C and Fortran API has changed to support MATLAB
variables with more than 2^32-1 elements. In the near future
you will be required to update your code to utilize the new
API. You can find more information about this at:
http://www.mathworks.com/support/solutions/en/data/1-5C27B9/?solution=1-5C27B9
Building with the -largeArrayDims option enables the new API.
**************************************************************************
Error: Could not find the compiler "cl" on the DOS path.
Use mex -setup to configure your environment properly.
C:\PROGRA~1\MATLAB\R2010A\BIN\MEX.PL: Error: Unable to locate compiler.
??? Error using ==> mex at 222
Unable to complete successfully.
Error in ==> mexFun at 25
mex helloworld.cpp
0 件のコメント
回答 (5 件)
Jan
2013 年 1 月 13 日
編集済み: Jan
2013 年 1 月 13 日
In the error message you find this section:
Error: Could not find the 64-bit compiler. This may indicate that the
"X64 Compilers and Tools" or the Microsoft Windows Software
Development Kit (SDK) is not installed. To build 64-bit MEX-files
Microsoft Visual C++ 2008 Express Edition requires that these two
packages are installed properly.
This seems to be clear: Did you install the SDK properly? Did you read this already:
5 件のコメント
DoVile Last Name:
2013 年 1 月 14 日
3 件のコメント
Ken
2013 年 1 月 16 日
I've got the exact same problem. Fresh install of Matlab 2012b 64-bit on a fresh install of Windows 7 Enterprise 64-bit. I can't get the 7.1 SDK to install no matter what I try. I've installed VC++ 2010 Express and mex can't find the compiler. When I tell it to use the default location anyway, this is what I get:
Warning: The default location for Microsoft Visual C++ 2010 compiler is: "C:\Program Files (x86)\Microsoft Visual Studio 10.0" but either that directory does not exist or the configuration is invalid.
Use C:\Program Files (x86)\Microsoft Visual Studio 10.0 anyway [y]/n? y
Please verify your choices:
Compiler: Microsoft Visual C++ 2010 Location: C:\Program Files (x86)\Microsoft Visual Studio 10.0
Are these correct [y]/n? y
*************************************************************************** Error: Could not find the 64-bit compiler. This may indicate that the "X64 Compilers and Tools" or the Microsoft Windows Software Development Kit (SDK) is not installed. To build 64-bit MEX-files Microsoft Visual C++ 2010 requires that these two packages are installed properly. ***************************************************************************
If I ever had the 64-bit compiler, it was likely deleted when Visual studio upgraded, as per one of your linked messages; but I can't re-install it as the installer requires SDK 7.1, which I can't install, getting the same error as DoVile. I've been cursing Microsoft for hours now. I'm very interested in the answer to this.
Ioan Alexandru
2014 年 7 月 10 日
I have the exact same problem. I installed all C++ compilers and Visual Studios from 2005 to 2013 without any positive results. I think this is a serious bug and Mathworks should do something about it since it greatly limits interfacing with 3rd party daqs...
1 件のコメント
Friedrich
2014 年 7 月 10 日
I pretty much doubt its a bug. Sounds more like an incomplete installation of the compiler. Check which compilers are supported in your release http://www.mathworks.com/support/sysreq/previous_releases.html and then make sure you also install the 64bit compiler package along with the 32bit one.
iyad salameh
2014 年 11 月 10 日
follow this and it should help
http://www.mathworks.com/matlabcentral/answers/64267-mex-files-and-compiler
0 件のコメント
Guilherme Verhalen
2018 年 1 月 15 日
I had the same issue, and after installing and re-installing the Microsoft SDK several times, found out that the issue was that another application added its install location on the Windows %PATH% and the folder name where it was installed had an especial character like "...\R&R\". This was causing the mex compiler to crash when expanding the Windows %PATH%. Removing this weird path solved my issue.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Troubleshooting in MATLAB Compiler SDK についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!