56 AnswersNew Answer
Let Me Explain - Part 2 Since C++ source files and header files are in plain text format they can be created in any text editor you desire, even editors as simple as Windows Notepad. When an editor or Integrated Development Environment (IDE) states that it has support for C++ it means that it has features that support writing code in C++. It does not mean that the editor includes a compiler. The support offered refers to features such as syntax highlighting, code folding, and auto completion. Thus, while an editor may have support for C++ it is not a C++ compiler. The same applies to IDEs. Code::Blocks is an IDE not a compiler. It even explicitly states this in its FAQ. http://wiki.codeblocks.org/index.php/FAQ-General#Q:_What_Code::Blocks_is_not.3F Some binary distributions of Code::Blocks may include a compiler bundled with it for convenience. However, Code::Blocks has support for multiple C++ compilers. Even Microsoft Visual Studio IDE is not a compiler. The Visual Studio IDE uses what are known as "workloads" for specific languages and targets. If you wish to develop C++ desktop applications using Visual Studio it is necessary to download and install the C++ Desktop Workload in addition to Visual Studio. These workloads contain the actual compiler toolchain, headers, and libraries. https://docs.microsoft.com/en-us/visualstudio/install/workload-component-id-vs-build-tools?view=vs-2019#c-build-tools
Let Me Explain - Part 3 The actual compiler toolchain usually consists of a number of command line utilities which may or may not include a build automation system. Microsoft usually provides CMake and MSBuild. The gnu make utility is available seperately for multiple operating systems. All of these utilities can be used from the command line if desired. I would recommend that any prospective C/C++ programmer learn how to build at least a hello world program from the command line. This can be of immense benefit when trying to solve tool chain problems or when configuring editors and IDEs manually. When it comes to choosing a native compiler for PC development there are a number of choices. If you are running linux then the native g++ compiler will more than likely already be installed. If it isn't then use your distribution's package manager to install it. For Windows systems it is possible to download the Microsoft C++ compiler command line tools from https://visualstudio.microsoft.com/downloads/ scroll down the page to "Tools for Visual Studio 2019", expand the dropdown and click on the download button in the "Build Tools for Visual Studio 2019" block. Alternatively, download Microsoft Visual Studio 2019 Community Edition with the C++ workload. If you wish to use the gnu compiler under Windows the mingw compiler is available from https://osdn.net/projects/mingw/releases/ Embarcadero provide an updated version of the Borland 32-bit compiler toolchain for free at https://www.embarcadero.com/free-tools/ccompiler The Open Watcom compiler is available from GitHub https://github.com/open-watcom/open-watcom-v2/releases Unless you are one of the unfortunate souls forced to use it by your educational institution then I would recommend that you avoid Turbo C like the plague. It is horrendously outdated.
udit nayyar Atom is an editor not a compiler.
The best compiler for C++ is the one that runs on your operating system of choice and supports the target system. Since C++ is a standard all standards compliant compilers should be the same. There may be differences with support libraries though. For example a Windows compiler will provide support for Windows development in addition to the standard libraries etc. Borland Turbo C is a waste of time. It is 33 years old and so far off from the current standards you may as well learn Z80 assembly language for CP/M machines. There is no single "best" compiler. Furthermore it appears that a lot of people here don't know the difference between an editor, an IDE, and a compiler. Which is rather worrying.
Let Me Explain - Part 1. Since there seems to be so much confusion over what a compiler actually is let me explain. A C++ compiler is a computer program which converts your C++ source code into an executable program. More correctly when we talk about a compiler we are referring to a toolchain. This is because compiling source code into an executable involves several stages. Firstly the code is put through a preprocessor which brings in any included files and performs macro expansion and substitution. The preprocessed code is then put through the actual compiler which generates object code. These two stages are repeated for each compilation unit (.cpp file). Finally the object file(s) are then linked against the C++ startup code, the standard libraries, and any additional libraries specified on the command line. These libraries could be static libraries or stubs for use with dynamic libraries. The C++ toolchain therefore includes a preprocessor, a compiler, a linker, and the necessary libraries to target the chosen platform. A toolchain that runs on and targets the same platform is known as a native compiler whereas a toolchain that runs on one platform but targets another is known as a cross compiler. Generally if the term compiler is used on its own it is assumed to mean a native compiler. This is most obvious with the gnu compiler since the full name reflects the cpu and architecture targeted e.g. arm-eabi-android-g++ is the g++ compiler that targets android systems using the eabi debugging format with the arm cpu instruction set. While arm-eabi-g++, or more correctly arm-eabi-none-g++, is a bare metal arm compiler for embedded systems; the target operating system being none or omitted from the name.
https://www.sololearn.com/Discuss/901003/?ref=app https://www.sololearn.com/Discuss/1362755/?ref=app https://www.sololearn.com/Discuss/402145/?ref=app https://www.sololearn.com/Discuss/1410647/?ref=app https://www.sololearn.com/Discuss/355860/?ref=app
On Linux, maybe g++.
On Windows, perhaps Visual Studio IDE with compiler.
However they say that it has support for C++ https://www.sololearn.com/post/660261/?ref=app
I found out that you can actually compile C++ on Atom. https://www.sololearn.com/post/660262/?ref=app Learnt something new.
Code blocks is another option.
Martin Taylor thanks for that explanation. Didn't realise that visual studio IDE proper did not come with the compiler/toolchain included. Wouldn't that make the IDE not so Integrated?
@Sonic The integration mentioned in an IDE is in reference to how the development environment interacts with the tools. While it can be hard to distinguish a high end editor from an IDE there are subtle differences. In an Integrated Development Environment (IDE) the development environment understands how to use the toolchain fully. An example of this is in how Visual Studio permits switching between different versions (release, debug, 32-bit, and 64-bit) of the same code base. Changing settings in the project menu directly effects the command line issued to the compiler. It is the workloads that are installed which contain extensions to Visual Studio as well as the toolchain that provide this integration. The Eclipse IDE uses plugins in a similar manner. Compare this with, for example, the Notepad++ editor and the NppExec plugin. This plugin has no understanding of what tool it is running. It is up to the developer to configure everything correctly i.e. it is not integrated with the tool chain. Even high end editors like Visual Studio Code are not integrated development environments. While the plugins for such editors do provide extensive support for the language, build automation, version control, and debugging they are not fully integrated with the toolchain as in Eclipse or Visual Studio. They are close enough in functionality to confuse many developers though. The MetroWerks CodeWarrior IDE (now owned by nxp) took integration to the extreme. The compilers were actually dynamic libraries, there were no command line tools. Additional compilers were added by installing new libraries.
QT is not a compiler.
Gautam Daga vscode is not a compiler.
Martin Taylor Very nice explaination for the newcomers 🙂👍
ABIDEX do some tutorials here and you will know.
What about atom?
Udit nayyar you can also search the compiler for c++ on Google .
Let's look at the top 7 best compilers in 2019. MinGW / GCC. Borland c++ Dev C++ Embracadero. Clang. Visual C++ Intel C++ Code Block.