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

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.

Related

Where are the Microsoft Visual C++ 2015-2022 Redistributable (x64) packages installed?

I know visual C++ 2015-2022 is installed because:
A. I see it in Apps & Features (Microsoft Visual C++ 2015-2022 Redistributable (x64) - 14.31.31103
B. I see it in registry HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\VisualStudio\14.0\VC\Runtimes\X64
but %VCINSTALLDIR% is not set on my path, and I cant find the dll's anywhere.
I need to be really specific with my IT dept to get this fixed. I want to add the dll to the system path but I have to find them first!
I managed to find VC_redist.x64.exe in C:\ProgramData\Package Cache\{2aaf1df0-eb13-4099-9992-962bb4e596d1} but I think that is pretty strange... it may be unrelated to the install.
Any help appreciated!
For me they are at
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Redist\MSVC
Do note that %VCINSTALLDIR% only works in the Visual Studio Developer Command Prompt. That should be located under the Visual Studio XXXX folder in your start menu or it can be launched directly from inside visual studio. You can then enter
cd %VCINSTALLDIR%
in the terminal to get where the directory is located on your machine.
According to Github/Microsoft Visual C++ Files are in %VCINSTALLDIR%Redist\MSVC\v143 folder.
The easiest way to locate the redistributable files is by using environment variables set in a developer command prompt. In Visual Studio 2022, the redistributable files are in the %VCINSTALLDIR%Redist\MSVC\v143 folder. In the latest version of Visual Studio 2019, you'll find the redistributable files in the %VCINSTALLDIR%Redist\MSVC\v142 folder. In both Visual Studio 2017 and Visual Studio 2019, they're also found in %VCToolsRedistDir%. In Visual Studio 2015, these files can be found in %VCINSTALLDIR%redist<locale>, where is the locale of the redistributable packages.
I know visual C++ 2015-2022 is installed because:
A. I see it in Apps & Features (Microsoft Visual C++ 2015-2022
Redistributable (x64) - 14.31.31103
...
You're confusing Visual Studio (the development environment) with Microsoft Visual C++ Redistributable (a runtime support library). There isn't even such a thing as "visual C++ 2015-2022". Each version of Visual Studio has one specific year, such as Visual Studio 2017 (VS2017). The redistributable works for all Visual Studio versions between VS2015 and VS2022.
%VCINSTALLDIR% is set by the command prompts of all Visual Studio version, but the value will differ between Visual Studio variants. You can install multiple versions of Visual Studio side by side on the same computer.

How to fix MSVCP120D.dll error Visual Studio 2015?

I am trying to run a C++ OpenCV 3.0 example in Visual Studio 2015 and I get a system error saying
The program can't start because MSVCP120D.dll is missing from your computer. Try reinstalling the program to fix this problem.
I have tried to reinstall Visual Studio but this does not fix the problem. Does anybody have any other solutions I could try?
The internal version of Visual Studio 2013 is 12. The DLL in question is version 12 (MSVCP120D, the D stands for Debug). You probably downloaded OpenCV compiled for Visual Studio 2013.
To use it with Visual Studio 2015 (known also as Visual C++ 14.0) you need to compile against VS 2015 or maybe find a download package pre-compiled for 2015.

MATLAB R2013b does not support Visual Studio 2013?

I have recently installed VS 2013. I have a .cpp project which I want to compile into mex with MATLAB 2013b. As soon as I enter:
mex -setup
in MATLAB and then I select "y" for "Would you like mex to locate installed compilers?", I receive the message that: "No supported SDK or compiler was found on this computer."
How can I get around this problem?
Visual Studio 2013 is not supported by MATLAB R2013b. See this link for more details: http://www.mathworks.com/support/compilers/R2013b/. The latest compiler and environment that R2013b can support for Windows is Visual Studio 2012. Your options are to either downgrade your version of Visual Studio to one that is compatible on that list I referred you to, or upgrade your version of MATLAB to at least R2014a or higher.

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.

what compiler does visual studio 2012 use for C++ and is it compatible/can I use it with codeblocks?

What compiler does visual studio 2012 use for C++ and is it compatible/can I use it with codeblocks?
I want to know because we're required to use Visual Studio 2012 for this school project and I would like to be able to trial some things with codeblocks.
Visual Studio 2012 is using the Microsoft compiler cl.exe. But anyway, you can maintain two projects (one for Visual Studio and one for CodeBlocks) - sharing the same source code.