Finding version of Microsoft C++ compiler from command-line (for makefiles)
I must be missing something really obvious, but for some reason, the command-line version of the Microsoft C++ compiler (cl.exe) does not seem to support reporting just its version when run. We need this to write makefiles that check the compiler version a user of our tool has installed (they get makefiles with code they are to compile themselves locally, so we have no control over their compiler version).
In gcc, you just give the option -v or —version to get a nice version string printed.
In cl.exe, you get an error for -v.
I have read the MSDN docs and compiler online help, and I cannot find the switch to just print the compiler version. Annoyingly, you always get the version when the compiler starts. but you seem not to be able to start the compiler just to get the version out of it.
Finding compiler vendor / version using qmake seemed similar, but only deals with the simple case of gcc.
I am trying this with VC++ Express 2005, if that matters. I hoped it would not, as detecting the compiler version is best done in a compiler-version-independent way 🙂
Как узнать какой компилятор c установлен
This forum has migrated to Microsoft Q&A. Visit Microsoft Q&A to post new questions.
![]()
- ProfileText
- Sign in
Answered by:
Question
Answers
The compiler will predefine some macros that you can detect to determine which compiler you are using.
For example, Microsoft Visual C++ is defining _MSC_VER to a value:
You should be able to make use of something like #ifdef _MSC_VER and #if _MSC_VER > 1400 or whatever your specific needs are.
You can also detect symbols like __WIN32__ to detect if you are in a Windows build environment. Some compilers will define __unix__ or __APPLE__ if your build environment is of that variety.
How to Check the Version of the GCC C++ Compiler Installed on a Windows PC

In this article, we show how to check the version of the GCC C++ compiler installed on a Windows PC.
So you may be able to check the version of the C++ compiler you have installed on your computer by going through your computer file system and seeing where the compiler was installed and then looking at the version.
But another, probably better way of doing it, is to go to the command prompt on a Windows PC and typing in the following line shown below.
After you run this, the command prompt will return the version you have installed of the GCC C++ compiler.
This is shown below.

So you can see in this case that the version of the GCC C++ compiler that I have installed on my Windows PC is g++ 8.1.0.
So if you ever need to check the version of the GCC C++ compiler that you have installed on your PC, you can do it through the command prompt by typing in the single line, g++ —version, and this will return the result.
So this is how to check the version of the GCC C++ compiler installed in windows.
how to check c++ version in windows 10 cmd?
To check the C++ version on a Windows 10 machine, open the Command Prompt and type «cl.exe«. The output will include the version number of the C++ compiler.
How do I know if C++ is installed in CMD?
What version of Visual C++ do I have CMD?
To check what version of Visual C++ you have installed on your machine, you can use the command line. Open up the command prompt by going to Start > Run and typing cmd. Then, at the command prompt, type cl.exe. This will output the version number of the compiler.
How do I know if C++ is installed on Windows 10?
To check if C++ is installed on Windows 10, you can:
-Check the Programs and Features list in the Control Panel
-Check if the Visual C++ Redistributable Package is installed
-Check if the Windows SDK is installed
-Check the environment variables
How do you check is C++ installed or not?
There are a few ways to check if C++ is installed on your system. One way is to check if the C++ compiler is in your PATH. To do this, open a command prompt and type «which g++» (without the quotes). If the C++ compiler is installed, you should see the path to the compiler displayed. Another way to check if C++ is installed is to try to compile a simple C++ program. For example, you can create a file called test.cpp with the following contents:
int main()
<
std::cout What is my current C++ version?
To check your current C++ version, you can compile a simple program with the following code:
int main()
<
std::cout How do I run C++ on Windows 10?
To run C++ on Windows 10, you will need to install a C++ compiler. There are many compilers available, but we recommend using Microsoft Visual C++. Once you have installed Visual C++, you can create a new project and select «C++» as the project type. Then you can add your C++ code to the project and build it.
How do I know my C++ version?
There are a few different ways to determine which version of C++ you are using:
1. Check your compiler’s documentation. Most compilers will have a flag that will print out the version number when invoked. For example, with GCC you can use the -v flag.
2. If you are using an IDE, it will likely have a way to check the version of C++ being used.
3. Check the version of the standard library you are using. If you are using the GNU Standard C++ Library, you can use the __GLIBCXX__ macro to determine the version.
4. Finally, you can check the C++ version by looking at the predefined macros in your source code.
What is the current version of C++?
The current version of C++ is C++17.
What is the latest C++ version?
The latest C++ version is C++17.
How do I choose C++ version?
The best way to choose a C++ version is to consult with your software development team or department. They will be able to advise you on which version will best suit your needs.
Which version of C++ should I use 2022?
The latest version of C++ is 20.2. You should use this version unless you have a specific reason to use an older version.
What version of C++ should I use?
There is no one-size-fits-all answer to this question, as the best C++ version to use depends on your specific needs and goals. However, in general, we recommend using the latest stable version of C++ (currently C++17). This will give you access to the latest features and improvements, while also ensuring that your code is compatible with the widest range of platforms and compilers.
Which C++ compiler for Windows?
There are many C++ compilers for Windows, but some of the most popular are Microsoft Visual C++, GCC, and Clang. Each has its own benefits and drawbacks, so it’s important to choose the one that’s right for your needs. If you’re just starting out, Visual C++ might be the best choice, as it has a lot of documentation and support available. GCC is a good choice for more experienced programmers, as it’s a very powerful compiler with a lot of features. Clang is a good choice if you’re looking for a fast, lightweight compiler.
How do I set up C++?
There are a few different ways to set up C++ on your computer, depending on your operating system and what development tools you want to use.
If you’re using Windows, you can install the free Visual C++ Express Edition from Microsoft. This will give you a basic C++ compiler and editor to get started with.
If you’re using Mac OS X, you can install the free Xcode development tools from Apple. These include a C++ compiler and editor, as well as many other useful tools for development.
If you’re using Linux, there are a number of different C++ compilers available. Many distributions come with a compiler pre-installed, such as GCC. You can also find IDEs (Integrated Development Environments) for Linux which include a C++ compiler and editor, such as KDevelop or Eclipse.