c++ linker error: undefined references only on optimized build

前端 未结 1 1687
执念已碎
执念已碎 2021-01-13 22:13

I\'m getting an undefined references linker error only when linking optimized objects files, not when linking unoptimized object files. I don\'t understan

相关标签:
1条回答
  • 2021-01-13 22:46

    int VisitedSet<T>::getSize() is a templated function, so its definition should be in a header file like COMPASS.h, not in COMPASS.cpp.

    Here's why: http://www.parashift.com/c++-faq/templates-defn-vs-decl.html

    0 讨论(0)
提交回复
热议问题