inline函数是不是不能在本类以外的地方调用?
永夜星空 2010-04-09 08:09:52 我在类FileNode中定义了一个函数FileNode::IsDirectory()为inline函数,因为它会被频繁调用就觉得inline速度可能快些吧.但当我在其它的地方(非FileNode成员函数)调用的时候就出了如下link错误:
错误 1 error LNK2019: 无法解析的外部符号 "public: int __thiscall FileNode::IsDirectory(void)" (?IsDirectory@FileNode@@QAEHXZ),该符号在函数 "int __stdcall Count(class Tree2Node *,long)" (?Count@@YGHPAVTree2Node@@J@Z) 中被引用 TreeView.obj Tree
如果把inline关键字删除就正常了.这是怎么回事呢