当我尝试在另一个项目中使用我的dll项目时,我收到错误LNK2001。
我的标题文件的代码是
#ifdef VIZFUNCTIONSDLL_EXPORTS
#define VIZFUNCTIONSDLL_API __declspec(dllexport)
#else
#define VIZFUNCTIONSDLL_API __declspec(dllimport)
#endif
namespace VizFunctions
{
class SUMCLASS
{
public:
static VIZFUNCTIONSDLL_API double Test(double a);
};
}
我的源文件的代码是
// VizFunctions.cpp : Defines the exported functions for the DLL application.
//
#include "stdafx.h"
#include "VizFunctions.h"
#include <stdexcept>
namespace VizFunctions
{
double SUMCLASS::Test(double a)
{
return a;
}
}
错误消息
Error 13 error LNK2019: unresolved external symbol "public: static double
__cdecl VizFunctions::SUMCLASS::Test(double)"
(?Test@SUMCLASS@VizFunctions@@SANN@Z) referenced in function "public:
int __thiscall CRectangle::PlugInNewGeom(int)" (?PlugInNewGeom@CRectangle@@QAEHH@Z)
C:\Program Files (x86)\vizrt\Viz3\plugin\src\examples\rectangle\Rectangle.obj SampleRectangle