error : in c++98 ‘v’ must be initialized by constructor, not by ‘{….}’

Hey there!

Have you ever used C++STL in CodeBlocks?

As I have noted, if you used below example code of vector in C++STL, after that you might face the error something like this

error : in c++98  ‘v’ must be initialized by constructor, not by  ‘{….}’

error: could not convert  ‘{1,4,6,8,10}’ from ‘<brace-enclosed initialize list>’ to ‘std::vector<int>’

vector c11

you know what? you can use the following steps to remove the error

  1. Go to CodeBlocks toolbar –> settings –> compiler
  2. Select option[Have g++ follow the c++ ISO c++ language standard[-std=c++11]
  3. Press ok
-std=c++11

Mohammed Anees

Hey there, welcome to aneescraftsmanship I am Mohammed Anees an independent developer/blogger. I like to share and discuss the craft with others plus the things which I have learned because I believe that through discussion and sharing a new world opens up

1 Comment

Leave a Reply

Your email address will not be published.