[问题] [已解决] Undefined reference to 'vtable

楼主: mhnp1580 (小路尼)   2012-12-17 23:00:56
[已解决]
不是constructor的问题,
是void printGate() const没有define
要多加{}
感谢帮我解惑的同学!!!
======================================================================
不好意思想了很久都无解 =____=
我在make的时候出现了以下的error message:
../../lib/libcir.a(cirMgr.o): In function `PI::PI(unsigned int, unsigned
int)':
/home/weining/Documents/hw6/src/cir/cirGate.h:60: undefined reference to
`vtable for PI'
collect2: error: ld returned 1 exit status
以下是程式码的部分
======================================================================
cirGate.h
class CirGate
{
public:
CirGate(unsigned i = 0, unsigned l = 0, CirGate* fi1 = 0, bool s1 = 0,
CirGate* fi2 = 0, bool s2 = 0) : _id(i), _line(l)
{
_fanin[0] = fi1;
_faninSign[0] = s1;
_fanin[1] = fi2;
_fanoutSign[1] = s2;
}
...
protected:
unsigned _id;
unsigned _line;
CirGate* _fanin[2];
bool _faninSign[2];
GateList _fanout;
vector<bool> _fanoutSign;
}
class PI: public CirGate
{
public:
PI(unsigned i = 0, unsigned l = 0) : CirGate(i, l) {}
...
};
然后在cirMgr.cpp的readCircuit()里:
CirGate* gPtr = new PI(id, lineNo);
=================================================================
如果我没有new PI就不会有以上的error message
但又不能不new PI =____=
拜托大家帮忙了感谢QQ
作者: peter0902 (Vigo)   2012-02-18 00:39:00
搜寻 vtable -> 12/20 12/17 12/17 每年HW6必经之路!
作者: ypf791 (路人1号)   2012-02-18 01:42:00
code 是不是不要这样 po 比较好....

Links booklink

Contact Us: admin [ a t ] ucptt.com