[問題] 關於inline與class的問題
若是這樣寫 compiler會過
但是要是你有呼叫
Value 這個函式的話
VC 2005就會顯示compiler error link1120, 無法解析的外部符號
a.h
class TreeNode
{
private:
public:
NodeVector * Children;
TreeNode * Parent;
int Item;
bool ItemIsIntra;
int ItemsetNumber;
int Support;
TreeNode( int anItem = -1, bool ItemIsIntra = false, int Sup = 0, TreeNode *
aParent = NULL );
inline TreeNode * FindChild( TreeNode * Child );
inline void Value( int anItem , bool xx , int Sup , TreeNode * aParent );
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
~TreeNode();
};
a.c
inline void TreeNode::Value( int anItem, bool xx, int Sup, TreeNode * aParent
){
Children = NULL;
Parent = aParent;
ItemsetNumber = 0;
Item = anItem;
ItemIsIntra = xx;
Support = Sup;
}
若是把inline拿掉就沒問題了, 請問為什麼不能inline呢, 她只是給值而已, 為什麼一
inline就錯誤呢 研究了一天 還是不得其解
只好PO上來問問大家 > < 謝謝
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.134.26.131
推
04/13 16:37, , 1F
04/13 16:37, 1F
→
04/13 16:38, , 2F
04/13 16:38, 2F
→
04/13 16:38, , 3F
04/13 16:38, 3F
→
04/13 16:39, , 4F
04/13 16:39, 4F
→
04/13 16:42, , 5F
04/13 16:42, 5F
→
04/13 16:46, , 6F
04/13 16:46, 6F
→
04/13 16:46, , 7F
04/13 16:46, 7F
→
04/13 16:47, , 8F
04/13 16:47, 8F
推
04/13 16:49, , 9F
04/13 16:49, 9F
→
04/13 16:56, , 10F
04/13 16:56, 10F
→
04/13 16:56, , 11F
04/13 16:56, 11F
推
04/13 17:05, , 12F
04/13 17:05, 12F
→
04/13 17:06, , 13F
04/13 17:06, 13F
討論串 (同標題文章)
以下文章回應了本文:
完整討論串 (本文為第 1 之 2 篇):
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章