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

前端 未结 1 1698
执念已碎
执念已碎 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::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)
提交回复
热议问题