Khan Saab
Khan Saab

Reputation: 511

Qualified name is not allowed in C++

I am beginner in C++ and have to work on a project. The following code is provided(header file) and when i import it, i get the error for namespace Utils.

namespace Utils::iterators {
    
    struct RetrieveKey {
        template<typename T>
        typename T::first_type operator()(T keyValuePair) const {
            return keyValuePair.first;
        }
    };

The error is .

"qualified name is not allowed".

I imported only boost library.

I have been busy with these errors for hours,if someone can tell me what the possible reason is of this error, it would be a great help.

Upvotes: 6

Views: 27429

Answers (1)

0x5453
0x5453

Reputation: 13599

Make sure you are compiling with C++17 since your header uses nested namespace specifiers (e.g. namespace Utils::iterators { ... }).

This can be done with the -std=c++17 flag for GCC/clang, or /std:c++latest for MSVC.

Upvotes: 15

Related Questions