user466444
user466444

Reputation: 489

interesting situation in c++

#include <iostream>
#include <stdlib.h>
using namespace std;

int main(int argc, char* argv[]) {
  std:: cout<<"hello world";
  std::cout<<"i am surprise<"<<std::endl;
    return (EXIT_SUCCESS);
}

It is very strange because I am using netbeans in Ubuntu 10.04 and run this code. What happens here really makes me surprised; every line of code is marked with red line. For example:

Please explain why is this happens?

Upvotes: 1

Views: 493

Answers (3)

exvion
exvion

Reputation: 76

Tools->Options->Code Assistance->C++ Compiler->add path C:\MinGW\bin. This solved the problem.

Upvotes: 1

Arnold Spence
Arnold Spence

Reputation: 22282

The paths for "Code Assistance" are configured separately from your compiler includes. They are usually set when your tool chain is configured but you can check them from the Tools > Options dialog. If your includes are not in any of the paths listed, you will have to add the path. Below is an example of my configuration: alt text

Upvotes: 1

Klaim
Klaim

Reputation: 69742

Your IDE's "on the fly" correction tool might not be working correctly (because of bad settings or because fo bugs). I'm guessing it just don't have the access to the default includes.

Your compiler is a separate tool that have access to the includes so it will compile fine anyway.

Try to set the settings correctly or turn the underlining off, or even switch to a better IDE for C++.

Upvotes: 1

Related Questions