由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - what's wrong with the following codes?
相关主题
template question#ifdef, #ifndef 这些 preprocessor 应该叫什么呀?
C++ question about template typedef最基本的C语言编程问题请教
C++ class template specialization questionWhy should i include .cpp instead of .h
inline functions in C++inline method
Help C++ Template function link error .怎样include一个函数
global variable usage question in C++gcc 编译的时候要包括 header source file 吗?
A weird segmentation fault![菜鸟问问题]请问如果有两个 C++ library
两个class的交叉引用问题弱问c++里有没有NULL这个keyword?
相关话题的讨论汇总
话题: tem话题: aux话题: following话题: func话题: void
进入Programming版参与讨论
1 (共1页)
c*******h
发帖数: 1096
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
y****e
发帖数: 23939
2
把tem_aux.cpp中的东西挪到tem_aux.h中去,compiler needs to know the template
function at compile time
1 (共1页)
进入Programming版参与讨论
相关主题
弱问c++里有没有NULL这个keyword?Help C++ Template function link error .
is there any lib can read .Z file in c++/c program?global variable usage question in C++
[合集] What is the inner class wrongA weird segmentation fault!
另一个Fortran 问题两个class的交叉引用问题
template question#ifdef, #ifndef 这些 preprocessor 应该叫什么呀?
C++ question about template typedef最基本的C语言编程问题请教
C++ class template specialization questionWhy should i include .cpp instead of .h
inline functions in C++inline method
相关话题的讨论汇总
话题: tem话题: aux话题: following话题: func话题: void