0

I have an existing project where the STL types are recognized. However, when creating a new project none of the STL types are not recognized. For example in

#include <string>
string s;

the colour of stringwill not change and compilation will generate errors.

Strangly enough when on the include line "Follow symbol under cursor" is executed the include file is opened. So the include file is there, Qt Creator knows how to open it and still class string is not recognized.

Did a reinstall of Qt5.5 but no avail. What's happening?

1
  • 4
    The STL type is called std::string, not string. Oct 7, 2015 at 10:12

1 Answer 1

1

you should use:

std::string

or:

using namespace std

at the beggining and you will not have to add the namespace every time

1
  • Or, better yet, using std::string, unless it's a header file in which case std::string is the way. Oct 7, 2015 at 10:20

Not the answer you're looking for? Browse other questions tagged or ask your own question.