QCTemplate已编译但无法链接

QCTemplate compiled but can't link

本文关键字:链接 编译 QCTemplate      更新时间:2023-10-16

我下载了QCTemplate (http://code.google.com/p/qctemplate/)在CTemplate(0.95)提供的版本中有一个错误,所以更改

我编译了库,但当我尝试运行helloworld示例时,我得到5关于ctemplate::TemplateCache的错误,如:

qctemplate.lib(template.obj):-1: error: LNK2019: unresolved external symbol "private: bool __thiscall ctemplate::TemplateCache::ExpandLocked(class ctemplate::TemplateString const &,enum ctemplate::Strip,class ctemplate::ExpandEmitter *,class ctemplate::TemplateDictionaryInterface const *,class ctemplate::PerExpandData *)" (?ExpandLocked@TemplateCache@ctemplate@@AAE_NABVTemplateString@2@W4Strip@2@PAVExpandEmitter@2@PBVTemplateDictionaryInterface@2@PAVPerExpandData@2@@Z) referenced in function "private: bool __thiscall ctemplate::TemplateTemplateNode::ExpandOnce(class ctemplate::ExpandEmitter *,class ctemplate::TemplateDictionaryInterface const &,char const * const,class ctemplate::PerExpandData *,class ctemplate::TemplateCache const *)const " (?ExpandOnce@TemplateTemplateNode@ctemplate@@ABE_NPAVExpandEmitter@2@ABVTemplateDictionaryInterface@2@QBDPAVPerExpandData@2@PBVTemplateCache@2@@Z)

我怎样才能使它工作?

解决。我编译了QCtemplate的src,但不知何故没有template_cache。cc在Qt Creator中导入,它没有被编译。我手动添加它并再次编译,现在它可以工作了。