![]() |
|
#1
|
|||
|
|||
Error LNK2019: unresolved external symbol...Hi, I´m new to c++ and inheritance therefore I have a problem with this code. Please help
I want to create two classes ("leaf" and "internal") that inherit from "node". I removed everything from the code to reproduced the error. When I call a function that uses "node" in "leaf.cpp" a link error occurs :S The error is: Linking... leaf.obj : error LNK2019: unresolved external symbol "public: void __thiscall node::test(class node *)" (?test@node@@QAEXPAV1@@Z) referenced in function "public: void __thiscall leaf::test(class node *)" (?test@leaf@@QAEXPAVnode@@@Z) C:\Documents and Settings\MiguelDeVezEmQuando\My Documents\Visual Studio 2005\Projects\tree\Debug\tree.exe : fatal error LNK1120: 1 unresolved externals Build log was saved at "file://c:\Documents and Settings\MiguelDeVezEmQuando\My Documents\Visual Studio 2005\Projects\tree\tree\Debug\BuildLog.htm" tree - 2 error(s), 0 warning(s) I got three ".h"s Node.h CPP / C++ / C Code:
Leaf.h CPP / C++ / C Code:
Internal.h CPP / C++ / C Code:
And one CPP Leaf.cpp CPP / C++ / C Code:
|
|||
|
#2
|
|||
|
|||
Re: inheritance problem, please help :PThe solution for this lnk2019 error is solved (Hurray) with a virtual destructor in class Node (though I dont understand why :S).
|
|
#3
|
|||
|
|||
Re: Error LNK2019: unresolved external symbol...For future reference, let's look at the error again. It's very informative, actually.
leaf.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall node::test(class node )" "unresolved external symbol" basically means the linker could not find a variable or function. And... virtual void __thiscall node::test(class node *) Tells us that the function in question is the member function test inside class node that takes a node as argument. Possible reasons as to why it cannot find it is that... 1) You have a function which you forgot to implement (ie, you simply forgot or you misspelled the name). 2) Misspelled variable. 3) All source files weren't compiled properly (can sometimes happen; a rebuild will likely solve that in VS |
Recent GIDBlog
Programming ebook direct download available by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Apache Web Server newbie problem | niss3 | Apache Web Server Forum | 1 | 13-Apr-2009 19:38 |
| Inheritance Suspicious Problem | Peter_APIIT | C++ Forum | 12 | 15-May-2007 23:01 |
| Class inheritance problem | Sita | C++ Forum | 11 | 07-Apr-2006 11:20 |
| inheritance problem | ap6118 | C++ Forum | 8 | 11-Apr-2005 12:24 |
| Inheritance problem | CaptnB | C++ Forum | 2 | 27-Jan-2005 09:09 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The