Setting up MATLAB with a C++ compiler [closed] - c++

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I'm kind of new to this, and just want to ask. How can I set up MATLAB to work with a C++ compiler. It seems that since I'm running Windows 8.1 as a prerelease, I'm not able to run visual studio 2013. So, I'm thinking of some C++ compiler that I can use when I run `mex -setup'
Update
I used Microsoft Windows SDK for Windows 7 and .NET Framework 4, and selected it as the compiler, and it worked.
Thanks.

mex -setup
All is documented here: http://www.mathworks.co.uk/help/matlab/ref/mex.html
The list of supported and compatible compilers for R2013b is here: http://www.mathworks.co.uk/support/compilers/R2013b/index.html
Older releases are linked from this page.

First do you have a C++ compiler installed on your PC? If you do this should work..
>>mex -setup
Please choose your compiler for building external interface (MEX) files:
Would you like mex to locate installed compilers [y]/n? n
Select a compiler:
[1] Intel C++ 9.1 (with Microsoft Visual C++ 2005 linker)
[2] Intel Visual Fortran 10.1 (with Microsoft Visual C++ 2005 linker)
[3] Intel Visual Fortran 9.1 (with Microsoft Visual C++ 2005 linker)
[4] Microsoft Platform SDK 14.0
[5] Microsoft Visual C++ 2005
[6] Microsoft Visual C++ 2008
Compiler: 5
The default location for Microsoft Visual C++ 2005 compilers is
C:\Program Files (x86)\Microsoft Visual Studio 8,
1
but that directory does not exist on this machine.
Use C:\Program Files (x86)\Microsoft Visual Studio 8 anyway [y]/n? n
Please enter the location of your compiler:
[C:\Program Files (x86)\Microsoft Visual Studio 8]
E:\Program Files (x86)\Microsoft Visual Studio 8
Please verify your choices:
Compiler: Microsoft Visual C++ 2005
Location: E:\Program Files (x86)\Microsoft Visual Studio 8
Are these correct [y]/n? y
Trying to update options file:
C:\Users\fullfanta\AppData\Roaming\MathWorks\MATLAB\R2008a\mexopts.bat
From template: E:\PROGRA~1\MATLAB\R2008a\bin\win64\mexopts\msvc80opts.bat
Done . . .

Related

MEX can't locate VS Express 2013 compiler - MATLAB R2013a

While setting up mex on my machine using mex -setup -v, VS Express 2013 compiler can't be found
for some reasons (see above screenshot). I still have VS 2010 installed on my machine, but I'd like to have the option to select the Express 2013 compiler on C:\Program Files (x86)\Microsoft Visual Studio 12.0\ . Has someone experienced such an issue so as to share his experience?
Thanks
Express Visual Studio compilers are not supported by Matlab.

Visual Studio 2013 can't located header files when using the VS 2010 platform toolset

Yesterday I had to reinstall Visual Studio 2010 on a computer with both VS 2012 and VS 2013, because I needed to compile older code. The Visual Studio 2010 installation caused header file issues, as described here . I followed the details provided in the answers, and got VS 2010 to install properly.
Now, when I run the VS 2010 version of msbuild, it compiles C++ code flawlessly. All the header files are properly installed in c:\program files (x86)\Microsoft Visual Studio 10.0\VC\include .
However, when I open a project in Visual Studio 2013, and set the Platform Toolset to v100 (which is VS 2010), it can't find the header files! Although they are right there!
This was originally a VS 2013 project, and I changed the platform toolset to VS 2010. This did not change the Include Directories property of the project, which was $(VC_IncludePath).
This macro is not defined by VS 2010, so the compiler can't find the include files.

Visual Studio 2013 is giving errors in file "C:\Program Files (x86)\Windows Kits\8.1\Include" [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
I am running on windows 7 64bit Visual studio express 2013 for windows desktop and I am getting errors regarding files in the directory mentioned in the title I have SDL and SOIL linked so that could be causing the problem. I'm not exactly sure what source code to show because the error list maxes out before it talks about any of my files.
It kinda seems like it is trying to compile for windows 8 but I don't want that. I just started with VS coming from Code Blocks and all my code compiled with no problems before.
Also should I be using VS 2012 for windows 7?
Go to Project -> Properties
In Configuration Properties -> General set Platform Toolset to Visual Studio 2013 - Windows XP (v120_xp).
If you set this setting to Visual Studio 2013 - Windows XP (v120_xp), then the required library files are read from the C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\... directories.
If you leave it to Visual Studio 2013 (v120), then they are read from the C:\Program Files (x86)\Windows Kits\8.1\... directories.
Now you can also run your programs (built in the release configuration) on older Windows systems (like Windows XP). Do this for both debug and release configurations.
Images and information gathered from:
3D C/C++ tutorials - Getting started in Visual Studio Express 2013.

How to skip debugging all of std namespace in Visual C++ 2013?

I want to skip debugging all of std:: namespace C++ by default, without code window changing to std:: code , authored by Microsoft as xstring . This question is similar to :
How to skip common classes in VS 2008 when stepping in? and
Auto-skip STL functions during step-by-step debugging in MSVC++2010 .
The only difference is that their solution are for visual studio 2008 and 2010. I tried it myself , and it works on visual studio 2010, but I want to do it on visual studio 2013. The same solution doesn't work on visual studio 2013. I tried changing all values in registry equal to :
_RTC_CheckEsp
to
std\:\:.*=NoStepInto
, some of these were values were for visual studio 12.0 ( which is visual studio 2013) , but after restarting visual studio 2013, nothing changed. On the contrary this works on Visual Studio 2010. "Just My Code" option is turned on.
As Hans Passant said, Edit the .natstepfilter files to add exclusions.
create a new file for example nostd.natstepfilter and write in it as in Has the VS2012 NativeDE\StepOver registry entry that prevents step-into for specific functions changed format?
<?xml version="1.0" encoding="utf-8"?>
<StepFilter xmlns="http://schemas.microsoft.com/vstudio/debugger/natstepfilter/2010">
<Function><Name>std::.*</Name><Action>NoStepInto</Action></Function>
</StepFilter>
For a 64-bit windows, move the file to :
C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Packages\Debugger\Visualizers
while for a 32-bit windows to:
C:\Program Files\Microsoft Visual Studio 12.0\Common7\Packages\Debugger\Visualizers
or whatever you customized you installation to. Please note that natstepfilter does not work in mixed mode (mixing native and managed code). Ensure that your project debugging settings is set to Native only

How to direct MATLAB's mex setup to the Microsoft Windows SDK for C++ compiling? (error in setting location)

I am on Windows Vista, and want to use MATLAB to compile C++ functions. I had only the lcc compiler on the system, as can be seen when running mex -setup :
mex -setup
Welcome to mex -setup. This utility will help you set up
a default compiler. For a list of supported compilers, see
http://www.mathworks.com/support/compilers/R2011a/win32.html
Please choose your compiler for building MEX-files:
Would you like mex to locate installed compilers [y]/n? y
Select a compiler:
[1] Lcc-win32 C 2.4.1 in C:\PROGRA~1\MATLAB\R2011a\sys\lcc
[0] None
Compiler:
since lcc does not work for C++ I installed the Windows SDK 7.1 from here(windows site). I ran the Windows SDK 7.1 Command Prompt to see the directory it is installed to and see C:\Program Files\Microsoft SDKs\Windows\v7.1. I then run mex -setup again to set the compiler to Microsoft Visual C++ 2010, by telling mex to not locate the installed compilers, I choose the Microsoft Visual C++ 2010 option and then the path MATLAB looks at by default is one for Visual Studio; C:\Program Files\Microsoft Visual Studio 10.0. I try to override it, but there it does not work. Here is the exact actions taken:
>> mex -setup
Welcome to mex -setup. This utility will help you set up
a default compiler. For a list of supported compilers, see
http://www.mathworks.com/support/compilers/R2011a/win32.html
Please choose your compiler for building MEX-files:
Would you like mex to locate installed compilers [y]/n? n
Select a compiler:
[1] Intel C++ 11.1 (with Microsoft Visual C++ 2008 SP1 linker)
[2] Intel Visual Fortran 11.1 (with Microsoft Visual C++ 2008 SP1 linker)
[3] Intel Visual Fortran 11.1 (with Microsoft Visual C++ 2008 Shell linker)
[4] Lcc-win32 C 2.4.1
[5] Microsoft Visual C++ 6.0
[6] Microsoft Visual C++ 2005 SP1
[7] Microsoft Visual C++ 2008 SP1
[8] Microsoft Visual C++ 2010
[9] Microsoft Visual C++ 2010 Express
[10] Open WATCOM C++
[0] None
Compiler: 8
Warning: The default location for Microsoft Visual C++ 2010 compiler is:
"C:\Program Files\Microsoft Visual Studio 10.0"
but either that directory does not exist or the configuration
is invalid.
Use C:\Program Files\Microsoft Visual Studio 10.0 anyway [y]/n? n
Please enter the location of your compiler: [C:\Program Files\Microsoft Visual Studio 10.0]
C:\Program Files\Microsoft SDKs\Windows\v7.1
Please verify your choices:
Compiler: Microsoft Visual C++ 2010
Location: C:\Program Files\Microsoft Visual Studio 10.0
Are these correct [y]/n?
*****************************************************************************
Error: Microsoft Visual C++ 2010 requires the Microsoft Windows Software
Development Kit (SDK), but the SDK cannot be found. Examine your
Microsoft Visual C++ 2010 installation.
*****************************************************************************
??? Error using ==> mex at 208
Unable to complete successfully.
I do not know whether the directory should be different from C:\Program Files\Microsoft SDKs\Windows\v7.1, and if there is a way to identify this directory. I also do not know if the way that I give the directory is correct. I tried using single quotes around the directory name and the only variation is the that it stops to ask me whether the directory to visual studio is correct or not, I answer n and only this is given.
Compiler: Microsoft Visual C++ 2010
Location: C:\Program Files\Microsoft Visual Studio 10.0
Are these correct [y]/n? n
mex: No compiler selected. No action taken.
How can I add the compiler to MATLAB to be able to run mex on C++ funcitons/files?
If you are after the quick and easy approach (and do not use 64-bit matlab) I would suggest you download a free copy of Visual Studio 2010 C++ express and use that. That way mex -setup will detect it.