-1

Why does Code blocks show me the error

error: in C++98 'pro' must be initialized by constructor, not by '{...}'|

When I use std::string pro{'A','B','C','D','E','F'};?

How can I fix this?

NathanOliver
  • 161,918
  • 27
  • 262
  • 366
A.R.S.D.
  • 160
  • 2
  • 11

1 Answers1

1

You are using C++ 98 standards and it doesn't support { } initialization.

You have two options...

  1. use -std=c++0x flag while compiling to use newer C++ standards.
  2. Do initialization in the constructor or somewhere else.
Jabberwocky
  • 45,262
  • 17
  • 54
  • 100
nipunasudha
  • 2,175
  • 2
  • 20
  • 44