I have the following code in eclipse: I'm running Indigo SR 2, 64bit with CDT Version: 8.0.2.201202111925 Build id: @build@ I have the Java SDK, Android SDK, and C++ CDT. I Believe the problem is only happening with c++ 11 functions: it seems Eclipse's internal code analyzer CODAN is not properly finding the libraries, even though the compiler is (i have the std=C++11 flag on my compilers).
I think this topic is related: http://www.eclipse.org/forums/index.php/t/490066/
#include <iostream>
#include <array>
using namespace std;
int main(){
cout << "test";
array<int,5> myints;
int x = 0;
cout << "size of myints: " << myints.size() << std::endl;
cout << "sizeof(myints): " << sizeof(myints) << std::endl;
return 0;
}
and I'm getting an error/ not compiling because I'm told:
Symbol 'array' could not be resolved
Why am I not compiling? I'm using eclipse indigo with the CDT and cygwin. I can provide more info as necessary.
UPDATE: I compile through eclipse (hammer button or right click project and click build) using Cygwin GCC and the Cygwin PE Parser.
Update 2: Running in indigo gives both an error in editor and a fail to compile, Kepler gives me the error, but seems to succeed running and compiling. Is there a way to make the error go away in kepler? Also, how would I get the actual command being passed to the compiler from within eclipse?
Update 3: More weirdness, after compiling in Kepler, it now compiles in indigo as well, though the errors persist in the text editor in both version.
1) Is there a way I can make these errors more accurate to the compile?
2) I can press f3 on the include and view it's source, so why can't eclipse seem to find the array symbol?
3) I'm also being told that the first std::endl
is an Invalid overload of 'std::endl'
Update 4: I tried std::tr1::array<int, 3> arr1 = {1, 2, 3};
and it's still telling me that array cannot be resolved. I've added -std=c++11
to my c/C++ Build -> Settings -> Cygwin C++ Compiler -> Miscellaneous -> Other flags. It now reads: -c -fmessage-length=0 -std=c++11
But I'm seeing no change at this point
Update: This question seems to be getting at the problem: Eclipse C/C++ Shows Errors but Compiles? However, I've added a link to the directory "D:/Wamp/cygwin64/lib/gcc/x86_64-pc-cygwin/4.8.2/include" and it hasn't changed anything...
Thanks!