Factsheet
Is installing GCC on Linux as complicated as I think it is?
linux - How do I check my gcc C++ compiler version for my Eclipse? - Stack Overflow
c++ - How can I compile for Windows on Linux with gcc/g++? - Stack Overflow
Fedora 44 pre release - dummy audio on Aorus Z390 Pro, unable to have sound output/input
Videos
Just type
gcc --version
in any terminal near you.. ;-)
gcc -dumpversion
-dumpversionPrint the compiler version (for example,3.0) — and don't do anything else.
The same works for following compilers/aliases:
cc -dumpversion
g++ -dumpversion
clang -dumpversion
tcc -dumpversion
Be careful with automate parsing the GCC output:
- Output of
--versionmight be localized (e.g. to Russian, Chinese, etc.) - GCC might be built with option --with-gcc-major-version-only. And some distros (e.g. Fedora) are already using that
- GCC might be built with option --with-pkgversion. And
--versionoutput will contain something likeAndroid (5220042 based on r346389c) clang version 8.0.7(it's real version string)
mingw32 exists as a package for Linux. You can cross-compile and cross-link Windows applications with it. There's a tutorial here at the Code::Blocks forum. Mind that the command changes to x86_64-w64-mingw32-gcc-win32, for example.
Ubuntu, for example, has MinGW in its repositories:
apt-cache search mingw
Output:
[...]
g++-mingw-w64 - GNU C++ compiler for MinGW-w64
gcc-mingw-w64 - GNU C compiler for MinGW-w64
mingw-w64 - Development environment targeting 32- and 64-bit Windows
[...]
The suggested method gave me an error on Ubuntu 16.04 (Xenial Xerus): E: Unable to locate package mingw32
===========================================================================
To install this package on Ubuntu, please use the following:
sudo apt-get install mingw-w64
After the installation, you can use it:
x86_64-w64-mingw32-g++
Please note!
For 64-bit, use: x86_64-w64-mingw32-g++
For 32-bit, use: i686-w64-mingw32-g++