PTT
Submit
Submit
选择语言
正體中文
简体中文
PTT
C_and_CPP
[问题] c++ template undefined reference
楼主:
yshihyu
(yshihyu)
2017-09-23 01:31:11
开发平台(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()'
楼主:
yshihyu
(yshihyu)
2017-09-23 02:29:00
AbstractOptimizationProblem.h:10:5: error: initializespecified for non-virtual method改成 = 0 编译变成这样错误
作者:
kkmoon5566
(56小弟)
2017-09-23 02:22:00
把constructor 设为pure virtual functionAbstractOptimizationProblem(int maxEvaluations, int maxIterations, ConvergenceChecker<PAIR>* checker<PAIR>* checker)=0;
作者:
kkmoon5566
(56小弟)
2017-09-23 11:48:00
讲错了= =" sorry这样好像可以了~
https://pastebin.com/x7csU8Cd
原因是compiler不知道template class要支持什么dataas the compiler does not know, while compiling Stack.cpp by itself, the data types it should providesupport for.来源:
https://tinyurl.com/y7qlx77b
楼主:
yshihyu
(yshihyu)
2017-09-24 01:57:00
嗯嗯~有部份错误有解! 不过 main.cpp:(.text+0x28): unAbstractOptimizationProblem<Evaluation>::AbstractOpti::AbstractOptimizationProblem(int, int, ConvergenceCh我在main.cpp 把 AbstractOptimizationProblem(maxEvalua改成 AbstractOptimizationProblem<Evaluation>(maxEvalu
继续阅读
[问题] 新手发问 do...while 要结束时请输入0
Eric2213
[问题] 每个task有自己的stack?
zzss2003
[问题] cuda 环境设定与使用问题
hardman1110
[问题] 请问这行组语是哪个指令集?
zzss2003
[问题] task是subroutine?
zzss2003
[问题] c++读档问题
goddbird
[问题] 建构式初始化串行和式中赋值的不同
asktin
Re: [讨论] 请问多层循环的flow chart怎么画?
MOONRAKER
[问题] volatile和multi-thread 的观念问题
dreamboat66
[讨论] 请问多层循环的flow chart怎么画?
zzss2003
Links
booklink
Contact Us: admin [ a t ] ucptt.com