Я написал очень простой код:
#include <iostream>
int main() {
std::cout << "Hello, World!" << std::endl;
return 0;
}
Но когда я пытаюсь его скомпилировать, я получаю сообщение об ошибке:
/Applications/CLion.app/Contents/bin/cmake/mac/bin/cmake --build /Users/user/CLionProjects/NewMath/cmake-build-debug --target NewMath -- -j 2
[ 50%] Linking CXX executable NewMath
Undefined symbols for architecture x86_64:
"std::basic_ostream<char, std::char_traits<char> >::operator<<(std::basic_ostream<char, std::char_traits<char> >& (*)(std::basic_ostream<char, std::char_traits<char> >&))", referenced from:
_main in main.cpp.o
"std::ios_base::Init::Init()", referenced from:
__static_initialization_and_destruction_0(int, int) in main.cpp.o
"std::ios_base::Init::~Init()", referenced from:
__static_initialization_and_destruction_0(int, int) in main.cpp.o
"std::cout", referenced from:
_main in main.cpp.o
"std::basic_ostream<char, std::char_traits<char> >& std::endl<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&)", referenced from:
_main in main.cpp.o
"std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)", referenced from:
_main in main.cpp.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
gmake[3]: *** [CMakeFiles/NewMath.dir/build.make:84: NewMath] Error 1
gmake[2]: *** [CMakeFiles/Makefile2:73: CMakeFiles/NewMath.dir/all] Error 2
gmake[1]: *** [CMakeFiles/Makefile2:85: CMakeFiles/NewMath.dir/rule] Error 2
gmake: *** [Makefile:118: NewMath] Ошибка 2
Я использую:
-Clion
-gcc8
-gmake
без ошибки Clion по-прежнему
Не могли бы вы помочь