magicDM
magicDM

Reputation: 95

How do i export class that fully defined in header file?

DLL Library:

// export.h
    #if defined(COMMON_EXPORT)
        #define COMMON_DLL __declspec(dllexport)
    #else
        #define COMMON_DLL __declspec(dllimport)
    #endif
// foo.h
class COMMON_DLL Foo
{
    int foo() { return 1; }
}

if i try to invoke this code from other library, then linker error happened. If remove COMMON_DLL from foo.h or move implementation of foo() method to .cpp file, then all work fine. Why is it so?

Upvotes: 0

Views: 860

Answers (0)

Related Questions