cout is not a member of std

I’m practicing using mulitple files and header files etc. So I have this project which takes two numbers and then adds them. Pretty simple. Here are my files: main.cpp #include <iostream> #include “add.h” int main() { int x = readNumber(); int y = readNumber(); writeAnswer(x + y); return(0); } io.cpp int readNumber() { int x; … Read more

Error “undefined reference to ‘std::cout'”

Shall this be the example: #include <iostream> using namespace std; int main() { cout << “Hola, moondo.\n”; } It throws the error: gcc -c main.cpp gcc -o edit main.o main.o: In function `main’: main.cpp:(.text+0xa): undefined reference to `std::cout’ main.cpp:(.text+0xf): 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*)’ main.o: In function `__static_initialization_and_destruction_0(int,int)’: main.cpp:(.text+0x3d): … Read more