[問題] c++ template undefined reference
開發平台(Platform): (Ex: Win10, Linux, ...) Linux
編譯器(Ex: GCC, clang, VC++...)+目標環境(跟開發平台不同的話需列出) g++
https://www.sendspace.com/file/55crup
上面網址是我程式碼 ...
g++ AbstractOptimizationProblem.cpp main.cpp
我程式馬里面有用到 template 但是我不太熟template ! 懂的朋友可以幫我看一下原因!
Thanks
下面是錯誤訊息
/tmp/ccQ0iTvh.o: In function
`LocalLeastSquaresProblem::LocalLeastSquaresProblem(int, int,
ConvergenceChecker<Evaluation>*)':
main.cpp:(.text+0x28): undefined reference to
`AbstractOptimizationProblem<Evaluation>::AbstractOptimizationProblem(int,
int, ConvergenceChecker<Evaluation>*)'
/tmp/ccQ0iTvh.o:(.rodata._ZTV24LocalLeastSquaresProblem[_ZTV24LocalLeastSquaresProblem]+0x10):
undefined reference to
`AbstractOptimizationProblem<Evaluation>::getEvaluationCounter()'
/tmp/ccQ0iTvh.o:(.rodata._ZTV24LocalLeastSquaresProblem[_ZTV24LocalLeastSquaresProblem]+0x18):
undefined reference to
`AbstractOptimizationProblem<Evaluation>::getIterationCounter()'
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 175.181.255.94
※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1506101475.A.142.html
推
09/23 02:22, , 1F
09/23 02:22, 1F
→
09/23 02:22, , 2F
09/23 02:22, 2F
→
09/23 02:22, , 3F
09/23 02:22, 3F
→
09/23 02:23, , 4F
09/23 02:23, 4F
→
09/23 02:29, , 5F
09/23 02:29, 5F
→
09/23 02:29, , 6F
09/23 02:29, 6F
→
09/23 02:30, , 7F
09/23 02:30, 7F
推
09/23 11:48, , 8F
09/23 11:48, 8F
推
09/23 20:28, , 9F
09/23 20:28, 9F
推
09/23 20:32, , 10F
09/23 20:32, 10F
→
09/23 20:32, , 11F
09/23 20:32, 11F
→
09/23 20:32, , 12F
09/23 20:32, 12F
→
09/23 20:33, , 13F
09/23 20:33, 13F
→
09/23 20:33, , 14F
09/23 20:33, 14F
→
09/24 01:57, , 15F
09/24 01:57, 15F
→
09/24 01:58, , 16F
09/24 01:58, 16F
→
09/24 01:58, , 17F
09/24 01:58, 17F
→
09/24 02:00, , 18F
09/24 02:00, 18F
→
09/24 02:00, , 19F
09/24 02:00, 19F