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
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
#endif
////////// the following is tem_aux.cpp //////////////
#include "tem_aux.h"
template
int i = 2;
}
when i compile usi