【发布时间】:2012-11-25 11:24:06
【问题描述】:
在 Visual c++ 中,我创建了一个包含两个文件 myLib.h 和 myLib.cpp 的静态库。我还有一个控制台应用程序项目,其中包含引用此库的文件 testSequence.cpp。
在 myLib.h 中,我定义了一个类 template<class prec> class sequence,它具有函数声明 prec *getPrimes(int numToGet),然后在 myLib.cpp 中定义此函数。但是,当我构建 testSequence 时,有一个链接错误,它说error LNK2019: unresolved external symbol "public: int * __thiscall mathLib::sequence<int>::getPrimes(int)" (?getPrimes@?$sequence@H@mathLib@@QAEPAHH@Z) referenced in function "char * __cdecl codeString(char *,char *,bool)" (?codeString@@YAPADPAD0_N@Z)
所以,是的,帮助会很好。
【问题讨论】:
标签: c++ visual-c++ static-libraries static-linking