C++17 Compiler throwing errors that aliased template "is not an element" of the containing namespace

  alias, c++, templates

So this one will be a hard problem to properly formulate so please go easy on me :).

I’m currently working on my own Matrix library (and no I’m not willing to use third-party libraries as especially this part is the main objective of my work).
To improve efficiency I made heavy usage of templates.
I tried to clean the code up a bit by declaring multiple alias templates for it.

The way I use to do it is by declaring these aliases with "using" which is the way that many modern Matrix libraries do it too.

All of these aliases are contained in a namespace to organize the code.

The thing is that I already wrote the Matrix implementation long ago and it never presented any trouble.

I proceeded to implement all the necessary activation functions all of which use these matricies and the aliases.
I even made sure to run the compiler at this point which didn’t pose any trouble.

Now I added several header files and the thing is none of them use these activation functions but as I tried to compile them the compiler started throwing errors at me comming from these activation functions.

Here is an example of how an activation function is generally implemented:

activations/identity.h (This throws the errors):

#pragma once
#include "activations/declarations.h"

struct Activation<Acv::IDENTITY> {

    template<class _DA>
    inline void activate(const nnarray::GenMatrix<_DA>& A) {}

    template<class _DA>
    inline void deactivate(nnarray::GenMatrix<_DA>& A) { //Irrelevant code }

The Matrix library was implement the following way:


#pragma once
#include "array/matrix.h"

namespace nnarray {
    template<class Derived>
    using GenMatrix = GeneralMatrix<Derived>;


#pragma once
#include "utils/macros.h"
#include <iostream>

namespace nnarray {
    template<class Derived>
    class GeneralMatrix;

    template<class Type, uint32_t m_, uint32_t n_, uint16_t alignment_, uint16_t padding_, uint8_t allocation_>
    class Matrix;

For some reason the compiler started to complain that "GenMatrix" is not an element of "nnarray" (VS Error-code: C2039)

Full error:
Error (active)  E0070   incomplete type is not allowed  Framework_CPU   arraymatrix.h  232 
Error (active)  E0260   explicit type is missing ('int' assumed)    Framework_CPU   activationsidentity.h  8   
Error (active)  E0018   expected a ')'  Framework_CPU   activationsidentity.h  8   
Error (active)  E0135   namespace "nnarray" has no member "GenMatrix"   Framework_CPU   activationsidentity.h  11  
Error (active)  E0018   expected a ')'  Framework_CPU   activationsidentity.h  11  
Error (active)  E0070   incomplete type is not allowed  Framework_CPU   arraymatrix.h  41  
Error (active)  E0070   incomplete type is not allowed  Framework_CPU   arraymatrix.h  137 

I already spent many hours trying to find the responsible piece of code but with not luck and in my desperation I finally gave up hoping one of you could provide clarity.

Side-note: Please excuse my way of writing in English, it’s not my primary language and I learned most of it at school so if the vocabulary does not fit in well I’d be happy for you to provide me with some possible improvements in my language and with the formatting 🙂

Of course I’d also like to thank all of you who read all this.
I’m kind of in a hurry with this project and my level of desperation is probably the highest it’s ever been.

EDIT: I removed alot of code as suggested by the comments. I’m sorry for the long text as I didn’t even had a clue what might cause this error so I just went the safe route and included most of it

Source: Windows Questions C++