When I change the clion compiler in toolchain to gcc-7 or gcc, it gives me undefined reference to every thing in a simple hello world program. this is my code :
#include <bits/stdtr1c++.h>
using namespace std;
int main()
{
cout << "hello world\n";
return 0;
}
and this is the build results :
====================[ Build | training | Debug ]================================
/opt/clion-2019.2.1/bin/cmake/linux/bin/cmake --build /home/saad/CLionProjects/training/cmake-build-debug --target training -- -j 2
Scanning dependencies of target training
[ 50%] Building CXX object CMakeFiles/training.dir/main.cpp.o
[100%] Linking CXX executable training
CMakeFiles/training.dir/build.make:83: recipe for target 'training' failed
CMakeFiles/Makefile2:72: recipe for target 'CMakeFiles/training.dir/all' failed
CMakeFiles/training.dir/main.cpp.o: In function `main':
CMakeFiles/Makefile2:84: recipe for target 'CMakeFiles/training.dir/rule' failed
Makefile:118: recipe for target 'training' failed
/home/saad/CLionProjects/training/main.cpp:5: undefined reference to `std::cout'
/home/saad/CLionProjects/training/main.cpp:5: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
CMakeFiles/training.dir/main.cpp.o: In function `__static_initialization_and_destruction_0(int, int)':
/usr/include/c++/7/iostream:74: undefined reference to `std::ios_base::Init::Init()'
/usr/include/c++/7/iostream:74: undefined reference to `std::ios_base::Init::~Init()'
collect2: error: ld returned 1 exit status
make[3]: *** [training] Error 1
make[2]: *** [CMakeFiles/training.dir/all] Error 2
make[1]: *** [CMakeFiles/training.dir/rule] Error 2
make: *** [training] Error 2
I installed GCC throw
sudo apt update
sudo apt install build-essential
sudo apt install gcc
Is their any other requirements to download to be able to compile a c++ program by GCC compiler in clion on ubuntu