Corupt compiler problem ?

closed account (N8RzwA7f)
Hi,
I have some very basic problem.
I can't even get this to work , it's complaining about not being able to resolve the identifier (string, cout, endl, cin)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
  #include <cstdlib>
  #include <string>
  #include <iostream>
  using std::string;
  using std::cout;
  using std::cin;
  using std::endl;
  
  int main() {
     string mystring;
     cout << "Enter string..." << endl;
     cin >> mystring; 
     return 0;
  }

Btw , this compiles, i just get warnings ? (yellow light bulb and red circle) I'm using netbeans.
this is just as an example code. I've had this in two programs now. One was this basic one to test it. This should be correct right??
Last edited on
Works perfectly fine for me yeh... weird. Can you show the second program?

Edit: Would be better if you pasted the full error messages.
Last edited on
What compiler are you using?

Edit: Also post the complete error messages, all of them, exactly as they appear in your development environment.



Last edited on
You "just" need to configure NetBeans correctly. Yesterday I wanted to try NetBeans and I had same problem. I've tried to fix it and I quit at the end, so now I'm using Visual C++. Have you tried to find answer on Google? - this problem is very common
E. g. http://stackoverflow.com/questions/14913243/netbeans-7-2-shows-unable-to-resolve-identifier-although-build-is-successful
Last edited on
closed account (N8RzwA7f)
I'm using mingw ?
closed account (N8RzwA7f)
I just get : unable to resolve indentifier cout
I get the same for string , cin , and endl as in : unable to resolve identifier string
I'm using mingw ?

What version? Please be more specific. Depending on the version this IDE can be severely outdated and broken.

closed account (N8RzwA7f)


Naaisus' link didn't help it.
I updated mingw using this link (in case others need it )

http://stackoverflow.com/questions/9865319/how-to-update-gcc-in-mingw-on-windows


I thought it worked, but no. The same errors again popped up when I debugged.

Also, I noticed that I do not get these errors when I use : using namespace std; instead
which I know is bad form so want to avoid.
any ideas ? Should I just reinstall ?
Last edited on
closed account (N8RzwA7f)
Please, can anyone help?
If it's just your IDE that shows these warnings/errors but the code compiles fine, I think the problem is with your IDE, and not with the compiler.
Last edited on
Topic archived. No new replies allowed.