How can I compile the vlfeat and mexopencv libraries in MATLAB using the Visual c++ compiler? - c++

I am working on a computer vision project, and I need to use the vlfeat and mexopencv libraries,
I am working with MATLAB R2008a and I cannot change the MATLAB compiler to compile and setup the libraries.
I have installed Microsoft Visual C++ Express, but I don't know how to compile the libraries using the Visual C++ compiler in MATLAB.

The reason why you can't find the compiler is because you are using MATLAB R2008a. The C++ compiler you have downloaded is probably too new for MATLAB to use. My guess is that you are using Express 2013. See the following link on what compilers R2008a can support for MEX here:
http://www.mathworks.com/support/compilers/release2008a/
Specifically, for the Express edition of the Visual C++ compiler, it can only support up to Version 8.0. You are most likely using an Express edition that is newer than 8.0. As such, the only way for you to use the Visual C++ compiler with R2008a is if you download the 8.0 Express edition and install it.
You can find that compiler here: http://go.microsoft.com/fwlink/?LinkId=51410&clcid=0x409
Once you install the Visual C++ compiler, you also need to install the SDK. You can find that here:
http://www.microsoft.com/en-ca/download/details.aspx?id=6510
After you do this, you need to define the MSSdk environment variable. To do this,
go to Control Panel -> System then Advanced and Environment Variables. After, create a new variable with the name MSSdk and the value being the path of where you installed the SDK. For example: C:\Program Files\Microsoft Platform SDK for Windows Server 2003.
Good luck!

Related

How can I setup CMake for use with Visual Studio 2017RC and CUDA 8.0?

Visual Studio 2017 RC includes much tighter CMake integration, allowing one to skip the intermediate step of generating project/solution files and use CMake effectively as the project file itself. There is sufficient documentation from Microsoft for using these features with regular C++ files, and there is sufficient documentation on this website (example) for making CUDA and Cmake play nicely, when it comes to linking CUDA code to C++ code.
What I can't find information on is how to make CMake, Visual Studio 2017 RC, and CUDA 8.0 all play nicely. This is a difficult problem, because 2017RC has no integration for the CUDA SDK anyways, and I was hoping to use 2017RC so that my C++ interface to the CUDA code could use C++14 and/or C++17. I'm working on the beginning of a large project that will primarily involve writing a static CUDA library that is accessed through C++: so, I'd like to get the CMake to take care of compiling my CUDA sources into a static library, and for it to help with feeding the linking information to Visual Studio. So far, I haven't had any success with using FindCUDA's various features to accomplish this, but I'm assuming that's due to a misunderstanding on my part. I've read through the documentation on separable compilation from Nvidia, but that wasn't helpful for figuring out CMake.
Further, whenever I try to use CMake in VS2017RC, I still end up with the various vcxproj files that CMake likes to spit out. Is this due to an error on my part? How do I edit the build command arguments, or CMakeLists.txt, to get the functionality demonstrated here to work?
The very short (and only at the time of writing) answer is that you can't. CUDA 8 doesn't support VS2017. Only VS2015 is presently supported.
You can always find the compiler/IDE versions which the release version of CUDA supports here
Edit to add that the CUDA 9 release will add official support for VS2017.
All you need to do is set the CUDA_HOST_COMPILER variable to a supported compiler for example the visual studio 2015 compiler.
In my case this is:
C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/cl.exe
As both runtime libraries are binary compatible you can use the 2015 compiler within CUDA and compile all the rest of the application with the 2017 compiler.

Installing Opencv with C++ without Visual studio

I want to use opencv with C++.
But i dont want to install Visual studio.
Is there any way i can do that ?
I could not find any proper installation guide for that .
Visual Studio is just an IDE that helps you to develop your project. To use OpenCV library on windows, you have to add the IncludePath, LibraryPath, and link the ddl libs. In fact Visual Studio make all the stuff easier.
There might be another solution by using MingGW compiler, but it is not recommended since you are using Windows and Visual Studio is the better choice.

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!

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.

How do I install the minimal facilities of Visual Studio 2008 sufficient for building C++ applications using Visual Studio 2010's multitargeting?

Dev10 has facilities for using the C++ compiler shipped in Orcas. However, I really don't need to install the full IDE -- I merely need to use Orcas' compiler because I need to support Windows 2000.
What's the simplest way of installing just the bits required to build using Orcas' toolset in Dev10?
Given your condition, I'd say just install VS2008 and use it. While it's not what you want it's the fastest path to working.
What about setting up Visual studio 2008 to work with Orcas compiler ?
I'm sorry I don't know about this very compiler, but I know it's possible to use VS2008 with a different compiler, because I tried it.
You can find plenty of doc on running VS2008 with, for example, the Windows SDK compiler or VS2010 compiler. For example that links explains that quite well : http://www.codeproject.com/Tips/105011/Using-Visual-Studio-2008-IDE-with-Visual-Cplusplus.aspx
HTH