Mex: compiler not found problem

64 Ansichten (letzte 30 Tage)
DoVile Last Name:
DoVile Last Name: am 13 Jan. 2013
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

Antworten (5)

Jan
Jan am 13 Jan. 2013
Bearbeitet: Jan am 13 Jan. 2013
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 Kommentare
Jan
Jan am 14 Jan. 2013
Bearbeitet: Jan am 14 Jan. 2013
@DoVille: Please explain "can't get SDK7.1 working" with any details.
DoVile Last Name:
DoVile Last Name: am 14 Jan. 2013
Accidently posted below, please see that post.

Melden Sie sich an, um zu kommentieren.


DoVile Last Name:
DoVile Last Name: am 14 Jan. 2013
I download SDK from
and start the install after downloading the .exe file. Somewhere just before installing ends i get the following message:
Installation failed
A problem occurred while installing selected Windows SDK components.
Installation of the "Microsoft Windows SDK for Windows 7" product has reported the following error: Please refer to Samples\Setup\HTML\ConfigDetails.htm document for further information.
Please attempt to resolve the problem and then start Windows SDK setup again. If you continue to have problems with this issue, please visit the SDK team support page at http://go.microsoft.com/fwlink/?LinkId=130245.
Click the View Log button to review the installation log.
To exit, click Finish.
Which i think is what gives me the troubles, atleast matlab still give me the same message as in the first post. I dont know where the ConfigDetails.htm document is supposed to be.
At this point i think meaby i should remove everything from the program list which has anything to do with C++ and try from scratch ? (but with what..)
Cheers Thor
  3 Kommentare
DoVile Last Name:
DoVile Last Name: am 15 Jan. 2013
The log is quote long,but it seems as if all the lines denote something succesfull except the last line:
20:30:35 15. januar 2013: [SDKSetup:Error] Config_Products_Install: Windows SDK Setup (failed): Installation of the "Microsoft Windows SDK for Windows 7" product has reported the following error: Please refer to Samples\Setup\HTML\ConfigDetails.htm document for further information. Stack: ved SDKSetup.Product.ConfigureNewProduct(ManualResetEvent CancelEvent) ved SDKSetup.Product.SetupProduct(TaskMode taskMode, ManualResetEvent CancelEvent) ved SDKSetup.ProductCollection.SetupProducts(TaskMode taskMode, DownloadManager downloadManager, ManualResetEvent cancelEvent) ved SDKSetup.ConfigProducts.DoCurrentTask(TaskMode Task)
I think meaby i need to find Samples\Setup\HTML\ConfigDetails.htm, but i have searched my PC without finding it..
Ken
Ken am 16 Jan. 2013
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.

Melden Sie sich an, um zu kommentieren.


Ioan Alexandru
Ioan Alexandru am 10 Jul. 2014
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 Kommentar
Friedrich
Friedrich am 10 Jul. 2014
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.

Melden Sie sich an, um zu kommentieren.


iyad salameh
iyad salameh am 10 Nov. 2014
follow this and it should help
http://www.mathworks.com/matlabcentral/answers/64267-mex-files-and-compiler

Guilherme Verhalen
Guilherme Verhalen am 15 Jan. 2018
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.

Kategorien

Mehr zu Troubleshooting in MATLAB Compiler SDK finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by