Ask Your Question

Revision history [back]

Test to see if you have a C++ compiler installed to your Linux system?

Which g++
Which c++

$ which c++

/usr/bin/c++

$ which g++

/usr/bin/g++

If no c++ or g++ compiler found installed in binary programs directory like '/usr/bin/" Then CMAKE cannot determine the correct path to the C++ compiler.

$ which c++

/usr/bin/which: no c++ in (/home/fred/.local/bin:/home/fred/bin:/home/fred/.local/bin:/home/fred/bin:/usr/share/Modules/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin)

$ sudo apt-get install c++ or for Fedora29 $ sudo dnf install c++

I would say you don't have any C++ compiler installed. Then CMAKE can verify that you have a C++ compiler installed into your Linux System

For Fedora29 Linux, I typed c++ on bash shell terminal input line

$ c++ bash: c++: command not found...

Install package 'gcc-c++' to provide command 'c++'? [N/y] y

  • Waiting in queue...
    • Loading list of packages.... The following > packages have to be installed: > gcc-c++-8.3.1-2.fc29.x86_64 C++ > support for GCC Proceed with changes? > [N/y] y > >
    • Waiting in queue...
    • Waiting for authentication...
    • Waiting in queue...
    • Downloading packages...
    • Requesting data...
    • Testing changes...
    • Installing packages...

c++: fatal error: no input files compilation terminated.

[fred@localhost llvm]$ c++ -v Using built-in specs. COLLECT_GCC=c++ COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/8/lto-wrapper OFFLOAD_TARGET_NAMES=nvptx-none OFFLOAD_TARGET_DEFAULT=1 Target: x86_64-redhat-linux Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,objc,obj-c++,ada,go,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl --enable-libmpx --enable-offload-targets=nvptx-none --without-cuda-driver --enable-gnu-indirect-function --enable-cet --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux Thread model: posix gcc version 8.3.1 20190223 (Red Hat 8.3.1-2) (GCC)