【发布时间】:2016-10-11 18:46:12
【问题描述】:
这可能是重复的,但是LNK2019问题太多了,我无法全部阅读。这是我的问题:我收到以下错误消息:
4>ScatterometerView.obj : error LNK2019: unresolved external symbol
"__declspec(dllimport) public: __thiscall CPGLGraphBitDlgBSDF::CPGLGraphBitDlgBSDF(class CPGLGraph *)" (__imp_??0CPGLGraphBitDlgBSDF@@QAE@PAVCPGLGraph@@@Z)
referenced in function "public: void __thiscall CScatterometerView::DisplayBSDFPlot(class BSDF *)" (?DisplayBSDFPlot@CScatterometerView@@QAEXPAVBSDF@@@Z)
当我查看DUMPBIN 的输出时,我看到了我的构造函数:
12 B 00002EFF ??0CPGLGraphBitDlgBSDF@@QAE@PAVCPGLGraph@@@Z = @ILT+7930(??0CPGLGraphBitDlgBSDF@@QAE@PAVCPGLGraph@@@Z)
除了__imp__,它什么都有。 DLL中的类定义如下:
#define PGL_EXT_CLASS _declspec(dllexport)
class PGL_EXT_CLASS CPGLGraphBitDlgBSDF : public CPGLGraphDlg
{
public:
static const int numPointsToAvg = 3;
CPGLGraphBitDlgBSDF();
CPGLGraphBitDlgBSDF(CPGLGraph* _pGraph);
~CPGLGraphBitDlgBSDF(void);
// ...lots more functions...
}
在可执行文件中的用法是:
CPGLGraph* pGraph = new CPGLGraph;
// ...code to fill in the graph data...
m_bsdf_plot = new CPGLGraphBitDlgBSDF(pGraph);
关键是类中的所有其他函数都可以工作;只有我最近添加的两个(包括这个构造函数)不起作用。旧功能没有我新添加的功能似乎需要的__imp__ 装饰。
创建的.def 文件没有定义任何函数,所以这似乎没有区别。我在链接器上使用了MAP file,唯一具有__imp__ 前缀的函数是Microsoft 定义的函数。 PGL.dll 中定义的单个函数都没有,它们都可以正常工作。请告诉我在哪里寻找问题甚至线索。
【问题讨论】:
标签: visual-c++ linker-errors lnk2019