Install Visualcpp c++ compiler on windows. Visualcpp is also called msvc, vcpp, visual studio, etc.
Find the visualcpp official webpages and download:
Microsoft Visualcpp: https://visualstudio.microsoft.com/downloads
For open-source cases, the community edition is good;
For commercial
cases, the professional and enterprise editions are good,
it is up to
you to choose.
After downloading the related installer setup.exe, click
it,
and follow the installer step-by-step,
when it asks the compiler or libraries,
make sure you choose the c++ desktop version,
c++ compiler, etc.
When finishing installing,
open the visualcpp IDE,
Create a new project,
Select empty c++ project,
Add
a new item hello.cpp to the source files,
Make
sure hello.cpp is open in IDE,
and copy
the following code to hello.cpp:
#include <iostream> int main() { std::cout << "Hello, c++!" << std::endl; }
Then click Build/Run button
to compile and run the c++ code,
the button might have a different
name, find it by yourself.
It should open a cmd window and show Hello, c++!
If it does not show that message and reports errors,
check your installation and configure, solve the installing problems.
Create a project ->
Click Project
on the menubar ->
Click Project Properties
->
Click c++ ->
Click Langauge ->
Find the c++ Language standard ->
Select Preview, ..., /std:c++latest
Microsoft visualcpp c++ compiler can be used as a commandline command one the
cmd window too,
the cmd is cl.exe
.
Copy-paste the above c++ code, save it as hello.cpp,
then open "Developer Command Prompt for VS" cmd window,
Run the compiling command:
cl.exe hello.cpp /std:c++latest
Also try
/std:c++23
/std:c++20
________________________________________
Written on Nov 02, 2024
c++ std::exception:
std::cout.write(err.data(), err.size());
std::cout << std::endl;
caught:
================================================== # The c++ programming language. # # # # Home: cppfx.xyz # # E # # Join c++ Discord: yZcauUAUyC # # Deck # ==================================================