vendredi 18 août 2017

C++ thinks std is a sub-namespace

I have a namespace called X. My code in namespace X uses an std::string. My C++ project uses the tag "-std=c++11". The declaration is exactly like this:

#include <string>

namespace X {

    const std::string myString = "...";

There's more to this, but you get the point of my declaration. However, it gives me the compiler error "string is not a member of X::std". It somehow thinks std is a namespace that was declared inside X, rather than the "standard namespace".

Why am I getting this error and how do I fix it?

Aucun commentaire:

Enregistrer un commentaire