how to setup Visual Studio Code for c++ for windows? [duplicate] - c++

This question already has answers here:
How do I set up Visual Studio Code to compile C++ code?
(14 answers)
Closed 3 months ago.
So my teacher is wants the class to install C++, and I don't know how to do it. Please help me set it up in Visual Studio Code because it's the IDE I'm most familiar with. Please explain it in the simplest way possible.
I tried installing vscode and c++ extension but library files are missing

If you are going to edit and execute on Windows, you have to install either Visual Studio regardless or g++ under MinGW. These instructions are very detailed:
https://code.visualstudio.com/docs/languages/cpp
To configure VSCode with MS compiler:
https://code.visualstudio.com/docs/cpp/config-msvc
To configure VSCode with gcc on Windows:
https://code.visualstudio.com/docs/cpp/config-mingw
Another alternative that I recommend is to use Windows WSL which is like a Linux inside Windows.
https://code.visualstudio.com/docs/cpp/config-wsl
Then install the C++ extensions for VSCode.
Then I recommend you install cmake for Windows. Although the tutorials will teach you how to build a single file, you will need more for large projects.
https://cmake.org/install/
Create a CMakeLists.txt and then use the cmake-gui to create the Visual Studio project files. All this is outside Visual Studio Code.
To build from inside VSCode I found it particularly cumbersome. I'd rather Alt-Tab and build the project manually by either calling 'make' or building inside Visual Studio. But it's your preference.
But if you are editing on Windows and running on Windows, I'd strongly suggest to run inside Visual Studio itself. Not only you will have way more support for your questions but also the Visual Studio debugger is arguably the best in the market.

Related

C++ Visual Studio makefile project on WSL2

I have a C++ project that I cross-compile using a makefile (written by me, not automatically generated).
I have recently moved to WSL2 and have been missing the good ol' days when I used Eclipse since (Visual Studio Code is not even close to what Eclipse can do).
I decided to give Visual Studio a go but I all I could find is this article about VS + WSL2 + cmake.
https://learn.microsoft.com/en-us/cpp/build/walkthrough-build-debug-wsl2?view=msvc-170
Is it possible to create a C++ makefile project under WSL2 with Visual Studio?

C++ Setup For VS Code [duplicate]

This question already has answers here:
How do I set up Visual Studio Code to compile C++ code?
(14 answers)
Closed 10 months ago.
So my teacher is wants the class to install C++, and I don't know how to do it. Please help me set it up in Visual Studio Code because it's the IDE I'm most familiar with. Please explain it in the simplest way possible.
If you are going to edit and execute on Windows, you have to install either Visual Studio regardless or g++ under MinGW. These instructions are very detailed:
https://code.visualstudio.com/docs/languages/cpp
To configure VSCode with MS compiler:
https://code.visualstudio.com/docs/cpp/config-msvc
To configure VSCode with gcc on Windows:
https://code.visualstudio.com/docs/cpp/config-mingw
Another alternative that I recommend is to use Windows WSL which is like a Linux inside Windows.
https://code.visualstudio.com/docs/cpp/config-wsl
Then install the C++ extensions for VSCode.
Then I recommend you install cmake for Windows. Although the tutorials will teach you how to build a single file, you will need more for large projects.
https://cmake.org/install/
Create a CMakeLists.txt and then use the cmake-gui to create the Visual Studio project files. All this is outside Visual Studio Code.
To build from inside VSCode I found it particularly cumbersome. I'd rather Alt-Tab and build the project manually by either calling 'make' or building inside Visual Studio. But it's your preference.
But if you are editing on Windows and running on Windows, I'd strongly suggest to run inside Visual Studio itself. Not only you will have way more support for your questions but also the Visual Studio debugger is arguably the best in the market.

Visual c++ problem in compiling native windows 10 application [duplicate]

This question already has answers here:
MSVCP140D.dll missing, is there a way around? [closed]
(2 answers)
Closed 3 years ago.
I'm coding a native C++ application in Vs 2019 that sould be able to run on a freshly configured windows 10 machine.
The problem is that when i run my .exe app on this machine i get missing dlls error such as MSVCP140D.DLL, VCRUNTIME140D.dll etc.
I tried to install the vcredist from MSDN on the guest machine and i also tried changing the "runtime library" from the "code generation" module in the project config.
I also followed some other tutorials that i've read on this platform but i can't find nothing that really works.
I even tried to place the missing dlls in the same directory of the .exe file to register them manually, actually it does not work, but this app i'm developing should be redistributable so the user should have just to execute it.
If i try to compile my program with another compiler such as MinGw it works but i wanted to use the vc++ default compiler if possible.
Is there a way to solve this issue?
Thanks!
Maybe you used MSVCP140.DLL, wihtout the D. the D stands for DEBUG and I don't know if the Debug version version comes with the visual studio redistributable. If you compile in visual studio try to build the Release version, this should work with the DLL´s from the redistributable

Visual Studio 2017 wont show c++ template/extansion

I am trying to use Microsoft visual studio IDE to run my c++ code, however, when I go to create a project, I do not see the option for a c++ project. I tried reinstalling the program to see if I could somehow install the package/extension however it just won't seem to come up.
The only templates that appear are in c# or f#.
If someone could please lead me into the right direction so that I can fix this, it would be great. Thank you.
I don't see any mention of C++ in the release notes.
According to this post on MSDN, there is no C++ support in the Mac version of Visual Studio. It contains links to instructions for using Visual Studio Code, as well as the option to install a VM running Windows.
Apparently Visual Studio Code supports C++ projects, since it can execute external tools. The Microsoft Visual C++ build tools are free for Windows, but I don't think there is a version for the Mac, so some other external compiler is necessary.

Compiling a C++ project in Visual Studio 2015 created in Linux containing make file

I have some C++ projects/programs which are created in Linux and containing make file as well.
I am using window 7 and visual studio 2015. Today I just installed Ubuntu Linux in virtual box BUT do not really know how to start with and run these programs.
What is the easiest way to run theses projects?
I am very new in C++ programming so a detailed answer is needed.
If you want to work in Visual Studio on Windows a good choice would be Visual C++ for Linux Development (VCLinux) : see tutorial here
The tutorial creates a Visual Studio (VS) project that builds with MSBuild (VS's internal build system). However you can also create a makefile project that will build with make. MSBuild is easier to work with if you know VS or have an existing VS project, make is more flexible and might be the best choice given an existing makefile. You should try some simple examples and decide which works for you.