Use the macro pattern for classes as well:
// For static linking, you might define MYLIBRARY_STATIC // which would define MYLIBRARY_API as nothing. #ifdef MYLIBRARY_STATIC #undef MYLIBRARY_API #define MYLIBRARY_API #endif a function declared dllimport may not be defined
To avoid this error in the future, follow these best practices: Use the macro pattern for classes as well:
If you ignore this error or fail to resolve it, you may encounter a range of issues, including: a function declared dllimport may not be defined