Install Visual C++ Compiler on Windows without installing whole Visual Studio - c++

NOTE This question can be duplicate of this or this question.
But please don't close it as duplicate without reading entire question.
I'm trying to install npm module browsersync on Windows, and by reading its documentation, I found that module itself uses node-gyp which requires C++ compiler on Windows to build native extension. And that leads to installation of Visual Studio (community edition will do). After going through above linked questions (which I noted as duplicates of my current question), I found that Windows SDK used to ship with C++ compiler but now Visual Studio is required to have C++ compiler.
So my concern is, do I really need to download and install that hefty 6 GB VS Community edition just to get that C++ compiler to build browsersync on Windows? or is there any way to do that via GCC for Windows?
P.S. Earlier I faced similar situation for installing node-oracledb.
Thanks.

#Niall covered where you can get the actual C++ compiler, but if you're looking for further information on the problem there's a walkthrough on how to get node-gyp up and running on Windows on their github issues page with the standalone compiler.

Related

C++ via Visual Studio Video - "Include file not found in browse.path." C/C++ [1, 1]

I have read numerous examples and videos to learn how to fix this to no avail. I am new to using Visual Studio Code and I seem to not be able to resolve this issue independently. I've reset my settings, deleted and reinstalled, etc. One common occurrence I am seeing is to access "MingGW", which I apparently do not have installed on my computer and/or have access to. I am in need of great assistance!
Apparently, the error is related to the fact that you don't have a compiler installed on your machine (or VS Code can't find its directory).
You can download the compiler from its official website here:
Mingw-w64
The answer is in your question ""MingGW", which I apparently do not have installed on my computer and/or have access to"
Install MingGw, and then compile.
Here is a Link to help you get started on setting up the MinGW for Visual Studio
It sounds like you are also new to C++. Are you on Windows? (I will assume so since you explicitly mentioned MinGW).
MinGW is an older version of the compiler, and I would encourage you to install the official Microsoft Sdk instead - that is, if you want the easy road.
Are you using Visual Studio or Visual Studio Code? They are two very different application, and if you are new to either programming or C++ I would heartily recommend Visual Studio as it does all the "complicated things" for you.
There is a difference between installing Visual Studio Code (a text editor) and a compiler (MinGW, MSVC++, clang, GCC, Intel, etc.).
Btw., I know your pain - we have all been there! Don't expect things to be easy in programming, it takes some time. This is especially true for C++ which has more complications than other languages (but worth the effort!).

How do I obtain Microsoft's C++ compiler and standard library (and just that)?

I want to try compiling some C++ code with Microsoft's C++ compiler, and using their standard C++ library. But, I would really rather not install their Visual Studio IDE. I have in the past installed "the whole enchilada", and the compiler naturally worked, but I recall it was really huge.
Now, I know Microsoft has a gratis Community Edition of its IDE, which includes its compiler, so I should be fine license-wise. Some browsing led me to this download site: https://visualstudio.microsoft.com/downloads/, but I only seem to be offered variants of Visual Studio, the IDE. If I search around for "Microsoft C++ Compiler", I either find Visual Studio sites, or downloads which seem more relevant scope-wise but are out of date, like this. Then there are Windows SDK's, I hope I don't have to get those, or do I? I also remember there are all sorts of "redistributable" packages you can download, and maybe other "build tools" packages - perhaps the compiler is really just a "build tool"?
If I do try the Visual Studio Community Edition installer - I ostensibly get the option to select which components I want to install. But, when I choose no components other than the "core C++ desktop features" (which probably means no compiler either), it wants to install 1.9 GB of data... and adding the MSVC v142 build tools bumps me up to 3.86 GB. Yikes!
Bottom line: What should I do so as to install just the MSVC compiler and the standard library (and the minimum possible set of other stuff I don't need alongside them)?
Note: This question is closely related to mine, but is not specifically about downloading and installing just the compiler and standard library. Hence one of the answers says: Download MSVS, but just run the compiler. The highest-scored answer ostensibly offers a Visual-Studio-independent download! ... except when you follow the link, you're immediately told the "build tools" are now part of Visual Studio 2017. IIUC anyway.
Visual Studio Build Tools is indeed the correct version. I have it installed on our build server.
Yes, it's called "Visual Studio" like the other products in the line, but that doesn't mean it comes with an IDE. It does come with the Visual Studio Installer, so you can select the C++ compiler.
The basic install is vs_buildtools.exe –quiet –add Microsoft.VisualStudio.Workload.VCTools. This is a C++ "workload" that's not available with the Visual Studio Community, where you'd use Microsoft.VisualStudio.Workload.NativeDesktop instead.

Where is cl.exe? (MS Build Tools ’13)

I just want the VC++ compiler, since some C++ graphics libraries (I'm planning to use and learn bgfx...) require it for compilation. For this I’ve downloaded and installed Ms. Build Tools ’13. However, I can’t find it.
My attempts:
1) I’ve ran Windows Command Prompt using the Batch input cl and it echoed 'cl'is not recognized as an internal or external command, operable program or batch file..
2) I’ve searched for a file with filename cl.exe on both "C:\Programs Files" and "C:\Programs Files (x86)" paths recursively and nothing. There’s no top folder related to MsVC++ or VC++ too, on the disk.
I cannot try to install Build Tools ’15 (nor VS) since the installer downloads at minimum 3 gygabytes and my network isn’t good.
Where can I find the compiler? Otherwise, is there any cross-platform graphics library (at least for Windows and Mac) that doesn’t need MSVC++ (e.g., just G++), please?
As a commenter mentioned, the Microsoft Build Tools 201x include tools to build managed apps (i.e. .Net apps), not native C++ apps. That's the answer to "where is cl.exe?" It's not there. It was never there.
That's true for the Microsoft Build Tools 2015 too, despite what you think and said. You're mixing up Microsoft Build Tools 2015 and Visual C++ 2015 Build Tools. Note the "C++" there (and the order of some of the words).
The Visual C++ Build Tools are the supported and recommended way by Microsoft to Build visual C++ projects without installing Visual Studio.
If your problem is internet connection get someone else to download it for you, seriously. You're really looking at it the wrong way.
Another alternative is the Enterprise WDK. It's "only" 1.9GB.
Otherwise, is there any cross-platform graphics library (at least for Windows and Mac) that doesn’t need MSVC++
Yes, you should be able to use modern OpenGL in a cross-platform way under Mingw using
GLFW (since it's a CMAKE compile-it-yourself library) and the excellent GLAD for handling loading of the modern openGL API on windows.

How can I get MatLab to find the Visual C++ Compiler?

Preamble: I found a solution in the midst of writing this, and this problem was a PITA and had a convoluted solution. Thus, I feel compelled leave this here to help any poor soul who has this problem.
I'm new to MatLab, and I don't usually use Visual C++ either, so forgive me if this should be painfully obvious.
Short version: I have Visual C++ 2013 installed on my computer, but mex can't find it when I run mex -setup c++. I get the following:
>>mex -setup cxx
Error using mex
No supported compiler or SDK was found. You can install the freely available
MinGW-w64 C/C++ compiler; see Install MinGW-w64 Compiler. For more options, see
http://www.mathworks.com/support/compilers/R2015b/win64.html.
Here's the full situation.
OS: Windows 10 Home
Compiler: Visual Studio 2013 (v120, up-to-date)
I confirmed that I can compile and run a program using this toolset.
MatLab version: 2015b
I was originally running Visual Studio 2015, and mex found the compiler just fine. However, I soon found out that Simulink is not compatible with VS 2015, so I had to roll back to VS 2013, and this is when my problem started.
I've tried, among many others, the following sites to find a solution:
The MatLab mex documentation - No help, only shows basic mex usage.
The MatLab supported compiler list - Confirmed that VC++ 2013 is compatable.
Then I went down a rabbit hole.
A very protracted mathworks.com answer that suggested other links. This led me to...
Another mathworks.com answer which sounds like my problem, and suggests patching my setup. Turns out that I don't have SDK 7.1 installed. So, I went to install, and got this error:
Some components could not be installed. Some Windows SDK components require the RTM .NET Framework 4...
This Stack Overflow question asks about this issue, and I hit the exact same issue Danilo Gadêlha had in regards to the .NET Framework already being installed.
I tried the top answer, and after removing every single reference to .NET framework of any version I could find, including those under "Windows Features", I still couldn't install.
I tried the next option, and even in safe mode, RegEdit wouldn't let me change the values suggested by the next answer, so that was a bust.
Lastly, I tried MandM's solution, which finally solved my chain of problems.
I think this was the root of my problem: when I uninstalled Visual Studio 2015 and installed Visual Studio 2013, an installation or registry setting was left in an incorrect state, and mex was unable to find Visual Studio 2013 as a result.
The solution that worked for me:
Leave Visual Studio 2013 installed.
As MandM answered:
Uninstall the following:
"Microsoft Visual C++ 2010 x64 Redistributable"
"Microsoft Visual C++ 2010 x86 Redistributable"
Before installing the Windows 7.1 SDK, and the install package reinstalls those two during installation.
As Robert Važan points out in the comments:
If error message persists despite this workaround, just click OK and proceed with installation. The installation will succeed this time..
I did get this error, but the install worked fine.
Install the SDK 7.1 Patch, which fixes the issue highlighted on this mathworks.com answer.

Gtkmm and cairomm with visual studio 11 (for the first time)?

I am learning c++ and wish to draw geometry to better enjoy the process and test my scripts.
I searched for a library to draw vectors in c++ and found Cairo came highly recommended on this site. I went ahead and downloaded Gtkmm that comes with Cairomm and installed it. I so far used this aweomse tutorial:
https://live.gnome.org/gtkmm/MSWindows/UsingMSVC
I followed the steps but I think this tutorial might be outdated or there may be an issue with one of the steps on MSVC 2012 with gtkmm-vc100-d-2_4.props (that is perhaps only supported on MSVC 2010).
In general I really want to get started but I am new to this and very confused atm.
It seems the current latest Project property file is not supported with Visual Studio 11 (2012).
I should have known that with the file name being, 'gtkmm-vc100-2_4'.
It works perfectly with VC10 so I reverted to using that for the time being.
I compiled gtkmm3 on Widnows 7 x64 (including cairo and others) for Visual Studio, see this
I have a CMake based project to build gtkmm on top of MSYS2 (it used to use OBS). It can be used with any version of Visual Studio supported by CMake as well as plain makefiles and jom makefiles.