I try to compile a very simple dynamic library project as .dll file. The name of the project is "Library". I'm using Visual Studio 2015 and the project properties are these:
In the project there are two files only: ClassA.h and ClassA.cpp.
The code in ClassA.h is:
#ifndef CLASSA_H
#define CLASSA_H
using namespace std;
#ifdef LIBRARY_EXPORTS
#define CLASSA_API __declspec(dllexport)
#else
#define CLASSA_API __declspec(dllimport)
#endif
class ClassA
{
public:
static CLASSA_API void func();
};
#endif
The code in ClassA.cpp is:
#include "ClassA.h"
#include <iostream>
void ClassA::func()
{
cout << "SUCCESS!" << endl;
}
When I try to compile this project I receive this error:
Severity Code Description Project File Line Error LNK1561 entry point must be defined Library C:\Users\UX303\Documents\Visual Studio 2015\DLLTest\Library\LINK 1
It is likely that your configuration is not right.
Be sure to double check your "Active Configuration" (Debug / Release), to see if you are really building a DLL.
I have just made such a mistake, and came across this question.