Hi I'm new to C++ programming and I try to make my first exercise on a mac using gcc in the terminal.
Unfortunately, I can't compile because of issues related to iostream. With a simple program as :
#include "<"iostream">"
int main() {
std::cout << "hello world";
std::cout << endl;
return 0;
}
it gives me the error:
error: ‘endl’ was not declared in this scope
removing the cout << endl; line gives me these errors:
Undefined symbols: "___gxx_personality_v0", referenced from: ___gxx_personality_v0$non_lazy_ptr in cceBlyS2.o "std::ios_base::Init::~Init()", referenced from: ___tcf_0 in cceBlyS2.o "std::basic_ostream >& std::operator<< >(std::basic_ostream >&, char const*)", referenced from: _main in cceBlyS2.o "std::ios_base::Init::Init()", referenced from: __static_initialization_and_destruction_0(int, int)in cceBlyS2.o "std::cout", referenced from: __ZSt4cout$non_lazy_ptr in cceBlyS2.o ld: symbol(s) not found collect2: ld returned 1 exit status
It's evident that the iostream header is not properly linked. I tried "<"iostream.h">" and "iostream.h" with no success.
Does anybody has any hint that could help me? Thanks!