My IDE (NetBeans) thinks this is wrong code, but it compiles correctly:
std::cout << "i = " << i << std::endl;
std::cout << add(5, 7) << std::endl;
std::string test = "Boe";
std::cout << test << std::endl;
It always says unable to resolve identifier .... (.... = cout, endl, string);
So I think it has something to do with the code assistance. I think I have to change/add/remove some folders. Currently, I have these include folders:
C compiler:
/usr/local/include
/usr/lib/gcc/i486-linux-gnu/4.4.3/include
/usr/lib/gcc/i486-linux-gnu/4.4.3/include-fixed
/usr/include
C++ compiler:
/usr/include/c++/4.4.3
/usr/include/c++/4.4.3/i486-linux-gnu
/usr/include/c++/4.4.3/backward
/usr/local/include
/usr/lib/gcc/i486-linux-gnu/4.4.3/include
/usr/include
What could be causing this, and how can I make NetBeans mark it as valid code?
It works fine for me. I'm using NetBeans 6.8; the only undefined reference I got was for the add() function.
Can you test with a new project to see if you can reproduce the problem?
EDIT (reply):
Yep, tested on Linux. No includes added in project properties.
In the global C/C++ options I have an extra include path for C, /usr/include/i486-linux-gnu
.
For C++ I have:
/usr/include/c++/4.4
/usr/include/c++/4.4/i486-linux-gnu
/usr/include/c++/4.4/backward
/usr/local/include
/usr/lib/gcc/i486-linux-gnu/4.4.3/include
/usr/lib/gcc/i486-linux-gnu/4.4.3/include-fixed
/usr/include/i486-linux-gnu
/usr/include
These are my defaults, haven't touched them. HTH I also use gcc-4.4.3 (Ubuntu 10.04).