C++ 11 begin() and end() functions [message #1767409] |
Wed, 05 July 2017 13:12  |
Eclipse User |
|
|
|
I am using Eclipse Oxygen and just tinkering around. I am attempting to compile this code:
#include <iostream>
#include <vector>
#include <list>
int main( int argc, char** argv ) {
int ia[] = { 0, 24, 98, 55, 22, 5, 8, 1, 62 };
std::vector<int> vec(ia, std::end(ia));
std::list<int> lst(ia, std::end(ia));
return 0;
}
I get the error the following errors:
Quote:
13:10:03 **** Build of configuration Debug for project array_it****
make all
Building file: ../array_it.cpp
Invoking: GCC C++ Compiler
g++ -std=c++0x -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"array_it.d" -MT"array_it.o" -o "array_it.o" "../array_it.cpp"
../array_it.cpp: In function 'int main(int, char**)':
../array_it.cpp:16: error: 'end' is not a member of 'std'
../array_it.cpp:17: error: 'end' is not a member of 'std'
make: *** [array_it.o] Error 1
13:10:03 Build Finished (took 320ms)
Any ideas why it's having a problem with the end() function? Thanks for the help in advance!
|
|
|
Re: C++ 11 begin() and end() functions [message #1767570 is a reply to message #1767409] |
Fri, 07 July 2017 04:13  |
Eclipse User |
|
|
|
It is working for me:
make all
Building file: ../src/Hello.cpp
Invoking: GCC C++ Compiler
g++ -std=c++0x -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/Hello.d" -MT"src/Hello.o" -o "src/Hello.o" "../src/Hello.cpp"
Finished building: ../src/Hello.cpp
I have double checked with g++ 4.8, 5.4 and 6.3 on my system and they all work as expected. It sounds like you have an old version of g++ to me.
|
|
|
Powered by
FUDForum. Page generated in 0.05437 seconds