A Function Declared Dllimport May Not Be Defined -

Then, inside your DLL project’s .cpp file, you define the function:

// mymath.dll ( implementation ) int add(int a, int b) { return a + b; } a function declared dllimport may not be defined

Use the macro pattern for classes as well: Then, inside your DLL project’s

__declspec(dllimport) tells the compiler: "This function exists in a different DLL — do not generate code for it here; instead, generate a call via the import library." inside your DLL project’s .cpp file