Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am using ubuntu 12.04. I have eclipse juno. I wrote test.cpp :

#include <iostream>
using namespace std;

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

I enter to the terminal and I succeeded to run it. The same file in eclipse I was also able to run but eclipse always warn about errors regarding the lines (red errors).

Why is it happening ? How can I fix it ? Why is it tells me : cout can not be resolved

share|improve this question

1 Answer 1

You must have not included some include directories required to correctly parse iostream.

  • Right Click on the project name.
  • Select Index > Search For Unresolved Includes.

    It will give you the list of unresolved includes which you can search in /usr/include and add the containing directories to C++ Include Paths and Symbols in Project Properties.

    On my computer, I have the following directories included:

    enter image description here

  • Rebuild the index (Index -> Rebuild) after adding include directories.

Source: http://stackoverflow.com/a/10804034/1626345

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.