0

I'm trying to compile a simple "Hello World!" That I made in C++

//============================================================================
// Name        : C++.cpp
// Author      : 
// Version     :
// Copyright   : All rights reserved.
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>

using namespace std;

int main() {
    cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!!
    return 0;
}

but I always get:

Unresolved inclusion on #include <iostream>
Symbol 'std' could not be resolved 
Symbol 'cout' could not be resolved 
Symbol 'endl' could not be resolved

I think I installed everything it needed (Cygwin64 make, gdb and gcc). What am I missing?

  • What toolchain settings do you actually have in the eclipse project? – πάντα ῥεῖ Oct 30 '14 at 19:31
  • 1
    Not related to your issue: though its use is prevalent in entry-level C++ code, I would strongly advise against ever including the line `using namespace std;` in your code. It's not much work to type the extra `std::`s, and it can help avoid *major* headaches. – Conduit Oct 30 '14 at 19:34

2 Answers2

0

You are probably getting linker errors, because you are not linking to the stdc++ library, if you are simply using gcc to compile your program.

See also this question - the simplest solution is probably to just use g++ for compiling and linking, or you can add -lstdc++ to the link command if you want to do it with gcc (see explanations under the linked question).

Community
  • 1
  • 1
Akos Bannerth
  • 1,964
  • 18
  • 14
0

After hours of searching I finnaly found out what was wrong, the path in the Enviroment was not set to C:\cygwin64