I write a small piece of code like above. But I can not compile it successfully.
I try it both with and without the line "using namespace std", but nothing worked. The error list:
Symbol 'initializer_list' could not be resolved
I use Eclipse CDT and GCC 4.9.1.
I hope somebody can find out the solution for this problem.
Thanks!
According to every tutorial, I see that code has no error. Unfortunately, it doesn't work for me. I just want to know whether somebody got this problem.
I've already added -std=c++0x. I had used many C++11 features successfully before, including initializer lists with vectors.
As I know, there is the correct initializer_list header in my computer. I can import this header by intellisense (maybe another name for autocomplete in Eclipse). But the intelisense shows me no result when i type "std::ini" and press Ctrl+Space.
I can use online compiler or Dev-C++ to compile and run it successfully.
Then how to solve this problem in Eclipse?