How to add a module API specifier "XXX_API" to a class declared in a namespace?

I have a class declared in a namespace as follows:

namespace sio
{
    class SOCKETIOLIB_API socket {
    };
}

I get compile error

error C2079: ‘socket’ uses undefined class ‘sio::DLLEXPORT’

This class is needed by other module in my plugin. How should I declare it as a public API?

1 Like

Solved.
Nothing special about namespace. The problem is causing by forgetting to include “CoreMinimal.h” in my header file where I try to declare a class with API specifier.

1 Like