Redian新闻
>
what's wrong with the following codes?
avatar
what's wrong with the following codes?# Programming - 葵花宝典
c*h
1
i have a `main' function that calls the `func' function
defined in `tem_aux.h'.
////////// the following is tem_main.cpp ///////////
#include "tem_aux.h"
int main(void) {
int a = 4;
func(a);
return 0;
}
////////// the following is tem_aux.h ///////////////
#ifndef _TEM_AUX_H_
#define _TEM_AUX_H_
template void func(T val);
#endif
////////// the following is tem_aux.cpp //////////////
#include "tem_aux.h"
template void func(T val) {
int i = 2;
}
when i compile usi
avatar
y*e
2
把tem_aux.cpp中的东西挪到tem_aux.h中去,compiler needs to know the template
function at compile time
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。