MATLAB R2013b does not support Visual Studio 2013? - c++

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.

Related

CUDA: Triple Angle Brackets gives me an error in Visual Studio [duplicate]

I'm trying to install CUDA, but I get a message saying "No supported version of visual studio was found". I think that this is because I am using Visual Studio 2017 (Community), and CUDA currently only supports up to Visual Studio 2015. Unfortunately, Microsoft will not allow me to download old versions of Visual Studio without paying a subscription fee.
Is there a way I can get around the compatibility issue with VS 2017, or can I not use CUDA?
If you want to install CUDA 8.0 with Visual Studio 2017 you need to install additional components for Visual Studio 2017.Click on the Start Menu and type Visual Studio Installer. Open Visual Studio InstallerOpen Individual components tab and select VC++ 2015.3 v140 toolset
under Compilers, build tools and runtimes.
You also need to install .NET Framework 3.5 if you didn't have it installed. Nvda.Build.CudaTasks.v8.0.dll assembly dependents on MS .NET Framework 3.5.
Open Classical Control Panel, go to Programs and features and press Turn Windows features on or off. Check .NET Framework 3.5 and press OK.
Download full CUDA toolkit distribution and extract it somewhere on your disk.
If you didn't have CUDA toolkit installed, do it now. If you have only Visual Studio 2017 installed, unselect Visual Studio integration checkbox.
Now you want to receive the "No supported version of the visual studio was found" error.
But in order to successfully build Cuda toolkit projects in Visual Studio 2017, you also need to follow steps 5 and 6.
Go to the CUDAVisualStudioIntegration\extras\visual_studio_integration\MSBuildExtensions folder in your extracted distribution, copy all the files and paste them to C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\v140\BuildCustomizations:
In the last step, you will need to edit your Cuda projects to recognize NVidia's build tasks from Visual Studio 2017. Open your .vcxproj file in a text editor and find all occurrences of CUDA 8.0.props. Replace the macro at the beginning of the string with $(VCTargetsPath14) so that XML snippet would look as follows:
<ImportGroup Label="ExtensionSettings">
<Import Project="$(VCTargetsPath14)\BuildCustomizations\CUDA 8.0.props" /></ImportGroup>
Don't forget to edit the custom targets path at the end of the file:
<ImportGroup Label="ExtensionTargets">
<Import Project="$(VCTargetsPath14)\BuildCustomizations\CUDA 8.0.targets" /></ImportGroup>
Make sure to double check your path conifuration!
If you use nvcc from command prompt you might not be calling cl.exe from Visual Studio folder!
Now you can build your Cuda project from Visual Studio 2017.
Parts of this solution are from Oleg Tarasov blog.
At the moment, Microsoft still seems to be making VS2015 Update 2 community edition available. You have to join the "dev essentials" program, but it seems to be free.
I was able to download the installer from here recently.
Update: CUDA 9 RC was made available yesterday at developer.nvidia.com to registered developers, and it has support for VS 2017.
Thank you everyone for your help. I just wanted to supplement this post with the last pieces of the puzzle. CUDA v9.0 RC is looking for VS2017 to identify as 1910 but the latest update actually identifies as 1911. To fix open .../CUDA/v9.0/include/crt/host_config.h and change this line:
#if _MSC_VER < 1600 || _MSC_VER > 1910
to this:
#if _MSC_VER < 1600 || _MSC_VER > 1911
You may also have to add the following to your CMakeLists:
list(APPEND CUDA_NVCC_FLAGS --cl-version=2017)
For people seeing this latter.
First, try to just install CUDA 10 (CUDA Toolkit 10.0).
If it still doesn't work without any mods make sure that you have as many VC++ toolsets as you see on the list. Check out this video, stop at 8:41 and compare the lists.
If for some reason you have to use CUDA 9.0 - 9.2 you will need to jump some hoops:
For cmd builds set vcvars_ver=14.11 - see this answer
For IDE builds set Platform Toolset (in project properties - General) to
Visual Studio 2017 (v141)) or
Visual Studio 2015 (v140))
If you have very customized cmd based build, hunt #if _MSC_VER (in .../CUDA/.../include/crt/host_config.h) and remove trailing || _MSC_VER > ...
In order to get working Cuda compiler nvcc in windows shell you need to do following
install proper toolset version from individual component for VS 2017 - VC++ 2017 version 15.4 v.14.11 toolset
Run in windows shell following "c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" x64 -vcvars_ver=14.11
You can compile nvcc code without errors from windows shell
I ran into the same issue using CUDA 9.1 and VS2017 Enterprise.
After changing the VC++ compiler to v140 (instead of 141) everything runs fine.
Already had flags
#if _MSC_VER < 1600 || _MSC_VER > 1911
But it wouldn't stop showing the error.
No idea why, but trying to run it on VS2015 lead to errors about v141 not being installed... so because of some twisted logic I tried to not use v141 where it was installed... and everything worked!!
Leaving this here as it may help someone else in the same situation. (although I really don't understand the why, how, when, who or what of the solution.
Latest update (correct as of 06/12/2018) latest Cuda version is 9.2 and latest Visual Studio version is 2017.7 do NOT work together. The instructions provided in solution above don't work. Here is what worked for me:
Uninstall Visual Studio.
Uninstall Visual Studio Installer
Download Visual Studio 2017.6 (note that Microsoft is known to change links and revisions without notice) https://learn.microsoft.com/en-us/visualstudio/productinfo/installing-an-earlier-release-of-vs2017
Launch installer
Go to Individual Components. Click on Windows 10 SDK 10.0.15063
enter image description here
Download cuda Toolkit from the official website: https://developer.nvidia.com/cuda-downloads?target_os=Windows&target_arch=x86_64&target_version=10&target_type=exelocal
You may need to download patch.
I wanted to edit my CUDA programs using a text editor (i.e. Sublime) and compile them from the command prompt but I ran into an nvcc compiler error. I installed Visual Studio 2017 with Windows 10 OS but after compiling, it said "only version of VS 2012, 13, 15 and 17 are allowed." So what I did was to intall VC++ 2015 toolkit from the installation package of the VS 2017 installer (refer to the image of the top post). I didnt go through his entire process instead, I only copied the path of my cl.exe file from the newly created VS 14.0 folder to the environment variable. The .exe can be found here:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin
Hope this helps!
Just as update. My compatibility is:
Cuda version 11.2
Visual Studio Community 2019

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.

matlab mex cannot find vcomp.lib when openmp is used

I am trying to mex a c++ source file containing openmp usages. In the mex command, i have added COMPFLAGS="/openmp $COMPFLAGS" but it says cannot find vcomp.lib. My matlab mex have been setup to use the compiler of Windows SDK 7.1 located in C:\Program Files. I checked the lib files inside this SDK and didn't find vcomp.lib. Anyone knows how can I install openmp to Windows SDK 7.1? Thanks a lot!
Based on this thread, it seems openmp is not shipped with Windows SDK. It is only shipped with Visual Studion Professional or Ultimate.
This matlab central site proposed a method to enable the matlab mex to use the Visual Studio 2013 compiler instead of the Windows SDK compiler. OpenMP is shipped with Visual Studio 2013 Professional and I can now compile code with OpenMp Enabled!

Visual Studio c++ download and excecution for new computer with windows 8.1 64bit

I just bought a new computer, with Windows 8.1 64bit installed and wanted to start developing in C++.I am new to Visual Studio, I used to do it with eclipse but suggestions I found in the internet were to prefer Visual Studio.
I tried to download Visual Studio C++ 2008 redistributable package (x64) from here http://www.microsoft.com/en-us/download/details.aspx?id=15336.
But I couldn't find where it was stored in my computer, after searching it with key words. Then I uninstalled it, to install again from scratch.
To uninstall it I opened my control panel and it saw that I have Microsoft Visual C++ 2012 Redistributable (x86) installed already, assuming it comes with the computer I bought, and the date of installation matches this. I can't find though where it is stored so I can't open it.
When downloading Visual Studio 2008, it says I need to uninstall previous Visual Studio versions.
Bottom line:
Should I uninstall the Visual 2012 (x86) that probably came with the computer (which is 64bit)? Or should I use it (and try to find where is it located)?
If I shouldn't use the 2012: Was the 2008 version I tried to install good? (2008 gives an "old" intuition, but just my intuition).
Is there an easy way to find out where the application is located for excecution? Any specific file to look for?
thank you
You want to download thee actual Visual Studio IDE from http://www.visualstudio.com/ . Try downloading the free Community Edition for a start.
The Visual Studio redistributable packages are actually the minimal runtime libraries to run C++ programs that were compiled with visual studio. You got a version installed by default even on fresh computers, otherwise you can't run many programs (they are also included with the IDE).
The redistributables are also often bundled with installers to make sure that others can run your programs.
The VC++ Redistributable packages only include the libraries required to run applications built with the respective version of Visual Studio (for example Microsoft Visual C++ 2012 Redistributable is for Visual Studio 2012).
It does not include any version of Visual Studio.
You could uninstall Microsoft Visual C++ 2012 Redistributable (x86) but however as it was preinstalled on your computer, I imagine that some program pre-installed by the computer manufacturer requires it. It's probably not a good idea to remove that.
So no, it's not a good idea to remove it.
In order to use the 2012 version of Microsoft Visual C++ 2012 Redistributable you should install the vs120 compiler, aka the VC++ compiler that comes with Microsoft Visual Studio 2012.
For developing with Microsoft Visual Studio 2008, using Microsoft Visual C++ 2008 Redistributable is completely fine as it matches the compiler version. However if you want to use the newer 2010, 2012, 2013, and 2015 versions you need to use those respective versions of the Microsoft Visual C++ Redistributable.
If you wish to use an up-to-date version of Visual Studio, try the Visual Studio 2013 Community Edition, or if you're feeling adventurous try the Visual Studio 2015 Release Candidate.
The application you built is always located in the project's directory, under /Debug or /Release, depending on whether you built a debug or release version of the application. If you do not know where your project folder is located you may right-click your project in the File pane and click Open folder in Windows Explorer.

Can I use build against the 2008 VS Runtime with VS 2010 and no copy of VS 2008?

It looks like using Visual Studio 2010 it is possible to build against the 2008 runtime, if you have both editions installed: Can I use Visual Studio 2010's C++ compiler with Visual Studio 2008's C++ Runtime Library?
Is it possible to do this using just the free Windows Platform SDKs and VS 2010? Just to stress - installing Visual Studio 2008 is not an option.
Background: I'd like to build a Python module for Python 2.7. I have a copy of Visual Studio 2010, but Python 2.7 (specifically the Python(x,y) distribution) is built using 2008. Rebuilding Python, or rebuilding Python(x,y) is not something I want to get into (there are various other modules I want to use as well). My module needs to link against vendor-supplied libraries built using VS 2008/2010 (I've been given both sets of libraries). I don't own a copy of Visual Studio 2008, and I really don't want to have to buy one.
This MSDN article says that although you can change the platform toolset in the IDE you still need to have the VS2008 binaries installed.
I know you said installing 2008 was not an option but perhaps you can still find the free versions in an old SDK or even the Express version on the Microsoft website.