0
我有一个头文件在一个.INL文件中的函数模板实现(的Visual C++)麻烦.INL文件C++
麻烦我有这个。
文件math.h - >>
#ifndef _MATH_H
#define _MATH_H
#include <math.h>
template<class REAL=float>
struct Math
{
// inside this structure , there are a lot of functions , for example this..
static REAL sin (REAL __x);
static REAL abs (REAL __x);
};
#include "implementation.inl" // include inl file
#endif
,这是.INL文件。
implementation.inl - >>
template<class REAL>
REAL Math<REAL>::sin (REAL __x)
{
return (REAL) sin ((double) __x);
}
template<class REAL>
REAL Math<REAL>::abs(REAL __x)
{
if(__x < (REAL) 0)
return - __x;
return __x;
}
正弦函数抛出我的错误在运行时,当我把它。但是,abs函数正确工作 。
我觉得麻烦的是调用.INL文件
为什么我不能用.INL文件内部文件math.h函数中的头文件math.h.的功能之一?
您是否要求我们推测您所看到的错误? – 2012-07-30 14:39:33