Minimal reproducible example :

While creating the project I chose empty project in the menu. After creating project I did change configuration type to dll.

After this I created two files, Calculations.h and cpp

Content of both the files :

**Calculations.h**

```
#pragma once
#ifdef CALCULATIONS_EXPORTS
#define CALCULATIONS_API __declspec(dllexport)
#else
#define CALCULATIONS_API __declspec(dllimport)
#endif
CALCULATIONS_API int AddIntImpl(int a, int b);
```

**Calculations.cpp**

```
#include "Calculations.h"
int AddIntImpl(int a, int b)
{
return a + b;
}
```

Now while building the same I am getting

```
1>Calculations.cpp
1>{...Path}calculations.cpp(5): warning C4273: 'AddIntImpl': inconsistent dll linkage
1>{...Path}calculations.h(9): note: see previous definition of 'AddIntImpl'
```

How do I resolve the same?

Source: Windows Questions C++