-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
  • 171,901
  • 28
  • 288
  • 402
A.R.S.D.
  • 180
  • 3
  • 13

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
  • 48,281
  • 17
  • 65
  • 115
nipunasudha
  • 2,427
  • 2
  • 21
  • 46