Namespace x has no member y | Adding namespaces to existing project

Hello!

I need help :< I have an existing project which worked fine until I decided to isolate a module and add it into its own namespace. Situation looks a bit like this:

File a.h:
1
2
3
4
5
namespace n {
    struct a {
        //stuff...
    };
}


File b.h:
1
2
3
4
5
6
7
8
#include "a.h"
namespace n {
    class b {
    public:
        void foo(const n::a& a1);
/* Here both GCC and intellisense agree that namespace n has no member a. Without n:: GCC says a is undefined. */
    };
}


Is it possible or is there magic going inside my includes? It's my first time creating my own namespaces so I might be missing something obvious... all ideas welcome. Thanks!
Last edited on
The code you have posted works perfectly fine. There must be something that you’re not showing us.
Thanks, found the problem. Turned out that it was with the additional headers for inline functions in another file.

Before:
1
2
3
4
namespace n {
    //stuff
}
#include "inlines.hpp" 


After:
1
2
3
4
namespace n {
    //stuff
#include "inlines.hpp"
}


It compiles!
Topic archived. No new replies allowed.