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