引自C++标准库:教程和手册:
目前使用模板的唯一可移植方法是使用内联函数在头文件中实现它们.
为什么是这样?
(澄清:头文件不是唯一的便携式解决方案.但它们是最方便的便携式解决方案.)
c++ templates c++-faq
什么是未定义的参考/未解决的外部符号错误?什么是常见原因以及如何修复/预防它们?
随意编辑/添加您自己的.
c++ c++-faq linker-errors unresolved-external undefined-reference
当我使用模板为类编写C++代码并在源(CPP)文件和标题(H)文件之间拆分代码时,在链接最终可执行文件时会出现大量"未解析的外部符号"错误,尽管目标文件正确构建并包含在链接中.这里发生了什么,我该如何解决?
c++ linker templates
c++ ×3
c++-faq ×2
templates ×2
linker ×1
linker-errors ×1
undefined-reference ×1
unresolved-external ×1