Best compiler for c++

which is best compiler for c++ i have listen from people it is visual studio i saw a video on youtube https://www.youtube.com/watch?v=10cBz9U6pBo how to run c++ program on visual studio can any one explain i am stuck in it
Last edited on
Best is what works best for you ;-)

Anyway, on Microsoft Windows there is hardly a way around Visual C++ (MSVC), whereas on other platforms (Linux, *BSD, Solaris, etc.) the GNU Compiler Collection (GCC) is the dominating C/C++ compiler.

You can use GCC on Windows, thank to Mingw-64/MSYS2, but that certainly is way less common than MSVC. And, for average Windows users, Mingw can be a bit "tricky" to set up correctly and get started.

There is also Clang (LLVM), which has gained some popularity recently and which often works as a "drop-in" replacement for GCC. Intel's oneAPI C++ Compiler may produce faster code, at least for x86 CPUs.
Last edited on
Well, that depends on a lot of factors. There are several compiler suites to choose from.

Do you want to do command-line compiling, or use an integrated development environment (IDE) that lets you do editing, compiling, testing and debugging from a GUI based interface?

What is your OS? That is another big datum point for choosing the right compiler.

Are you the only developer working on the code base?

If using C++20 is a mission critical factor then there is only one current choice, Microsoft's Visual Studio 2022, is free for students and non-commercial use in a Community edition.
Thank you
George P and Kiger64551 but i am unable to run my program on visual studio i follow the same steps but program is not working
Last edited on
what exactly is the error message or, if none, describe the problem a bit.
or, back it up. does hello world work for you?
VS has a lot of templates for new projects, some of which do not use the normal c++ main. Did you pick one of those? Look at the project choices again, there is one for console that defaults with hello world ready to go, use that one and see if it works.
Forget about learning C++ via youtube, many of the "experts" aren't.

One of the best free online tutorials for C++: https://www.learncpp.com/

It shows how to properly setup VS and Code::Blocks, both are IDEs. There is also a "test" program lesson to make sure the IDE is working correctly.

One thing to note about Visual Studio being able to compile C++ is not installed by default, the package has to be manually selected. If you already have VS installed the C++ package can be added by using the installer to modify the installed packages.
For Windows, definitely VS2022. When you installed it, did you configure the install options to install C++? This is not installed by default.

but program is not working


What is meant by 'not working'. Does it compile without errors? If you have C++ installed, then what compile errors are you receiving? If it compiles OK, then what happens when you run the program?

Have you configured the Project Properties? The default values may not be as required.

If you run VS Installer and click on the modify button then on the right you should see information about Desktop Development with C++. If you don't, then you need to install C++ for desktop development.

thanks you seeplus yes i had not installed c++ thank once again
Topic archived. No new replies allowed.