| | |
| Stránka: 1 z 1
| [ Príspevkov: 4 ] | |
Autor | Správa |
---|
Registrovaný: 16.09.08 Prihlásený: 09.07.13 Príspevky: 43 Témy: 11 Bydlisko: Radola |
Chcel by som trosku pomoct s tým to hadze to že ...
Kód: Error 1 error LNK2019: unresolved external symbol "public: __thiscall TreeNode::TreeNode(void)" (??0TreeNode@@QAE@XZ) referenced in function "public: __thiscall Or::Or(class TreeNode,class TreeNode)" (??0Or@@QAE@VTreeNode@@0@Z)
keby ste boli taký dobry a vedeli pomocť treenode.cpp Kód: #include <iostream> #include "TreeNode.h" #include "Table.h"
using namespace std;
TreeNode::TreeNode(TreeNode* Left, TreeNode* Right) { LeftPtr = Left; RightPtr = Right; }
Or::Or(TreeNode *Left,TreeNode *Right) { LeftPtr = Left; RightPtr = Right; }
Not::Not(TreeNode* Left,TreeNode* Right) { LeftPtr = Left; RightPtr = NULL; } Xor::Xor(TreeNode* Left,TreeNode* Right) { LeftPtr = Left; RightPtr = Right; } And::And(TreeNode* Left,TreeNode* Right) { LeftPtr = Left; RightPtr = Right; } Variable::Variable(int Index, Table T) { Value = T.GetVariableValue(Index); };
bool Variable::Evaluate() { return Value; };
bool And::Evaluate() { return (LeftPtr->Evaluate() && RightPtr->Evaluate()); };
bool Or::Evaluate() { return (LeftPtr->Evaluate() || RightPtr->Evaluate()); };
bool Xor::Evaluate() { return (LeftPtr->Evaluate() ^ RightPtr->Evaluate()); };
bool Not::Evaluate() { return (!LeftPtr->Evaluate()); };
treenode.h
#ifndef __TREENODE_H__ #define __TREENODE_H__
#include <iostream> #include "Table.h"
using namespace std;
class TreeNode { protected: TreeNode* LeftPtr; TreeNode* RightPtr; public: TreeNode(); TreeNode(TreeNode*, TreeNode*); virtual ~TreeNode(void) { delete [] LeftPtr; delete [] RightPtr; } virtual bool Evaluate(void) { return false; } };
class Variable :public TreeNode
{ public: Variable(int, Table); bool Evaluate(); virtual ~Variable() { delete [] LeftPtr; delete [] RightPtr; } private: bool Value; };
class Or : public TreeNode
{ public: Or(TreeNode* ,TreeNode* ); virtual ~Or() { delete [] LeftPtr; delete [] RightPtr; }; bool Evaluate(); private:
};
class Xor : public TreeNode
{ public: Xor(TreeNode* ,TreeNode* ); virtual ~Xor() { delete [] LeftPtr; delete [] RightPtr; }; bool Evaluate(); private:
};
class Not : virtual public TreeNode {
public: Not(TreeNode *,TreeNode *); virtual ~Not() { delete [] LeftPtr; delete [] RightPtr; }; bool Evaluate(); private:
};
class And : public TreeNode { public: And(TreeNode *, TreeNode *); virtual ~And() { delete [] LeftPtr; delete [] RightPtr; }; bool Evaluate(); private:
};
#endif
main
#include<iostream> #include"Table.h" #include"TreeNode.h"
const int N = 3;
void main() { Table *table = new Table(N); table->SetVariable(0,true); table->SetVariable(1,true); table->SetVariable(2,true);
TreeNode* root = new Or (new Variable (0,*table),new Variable (1,*table)); }
// pridané po 1 hodine 17 minútach od posledného príspevku
Viem že je už vela hodín ale ste moja posledna nádej.. zajtra to musí ísť..:/ prosím o pomoc
// Premenovane + kod patri do code. Zacni pisat ako clovek, neda sa to citat. Ďuri
_________________ CPU:AMD Phenom™ X4 Quad-Core Black Edition 9950 3GHz RAM:4GB 1066MHz KINGSTON HyperX DOSKA:GIGABYTE MB Sc AM2+ MA790FX-DQ6, AMD 790FX, 4xPCIe, 4xDDR2, 8xSATA2, 2xGLan GRAFA:Sapphire VGA ATI Radeon HD 4870, 512 MB GDDR5, 256-bit, 750/3600, 2x DVI, HDTV, PCI-E KLAVESNICA: Microsoft Sidewinder X6 |
|
Registrovaný: 11.01.09 Prihlásený: 26.04.24 Príspevky: 1385 Témy: 9 Bydlisko: Hrinova | Napísal Fico: 11.05.2011 8:46 | |
|
Z chyby vyplyva, ze nevie najst bezparametricky konstruktor TreeNode::TreeNode(), tak si staci doplnit jeho definiciu do treenode.cpp, lebo ju tam nemas, pricom v hlavickovom subore mas prototyp uvedeny. Dalsie chyby ti neviem najst, neprilozil si totiz subor Table.h, nejde to skompilovat.
|
|
Registrovaný: 16.09.08 Prihlásený: 09.07.13 Príspevky: 43 Témy: 11 Bydlisko: Radola |
Kód: #ifndef __TABLE_H__ #define __TABLE_H__
class Table { public: Table(int); ~Table(); void SetVariable(const int IndexOfVariable, const bool NewValue); bool GetVariableValue(const int IndexOfVariable); private: bool *ptrTable; };
#endif
#include "Table.h"
Table::Table(int n) { ptrTable = new bool[n]; }
Table::~Table() { delete ptrTable; }
void Table::SetVariable(const int IndexOfVariable, const bool NewValue) { ptrTable[IndexOfVariable] = NewValue; }
bool Table::GetVariableValue(const int IndexOfVariable) { return(ptrTable[IndexOfVariable]); };
este sa to erroruje
_________________ CPU:AMD Phenom™ X4 Quad-Core Black Edition 9950 3GHz RAM:4GB 1066MHz KINGSTON HyperX DOSKA:GIGABYTE MB Sc AM2+ MA790FX-DQ6, AMD 790FX, 4xPCIe, 4xDDR2, 8xSATA2, 2xGLan GRAFA:Sapphire VGA ATI Radeon HD 4870, 512 MB GDDR5, 256-bit, 750/3600, 2x DVI, HDTV, PCI-E KLAVESNICA: Microsoft Sidewinder X6 |
|
Registrovaný: 20.03.11 Prihlásený: 01.11.11 Príspevky: 27 Témy: 0 |
Mne to skompilovať ide, ale debbuger vypisuje hlášku:
Citácia: File: dbgdel.cpp line 52 Expression: _Block_Type_Is_Valid (pHead->nBlockUse) For information on how your program can cause an assertion failure, see the vc++ documentation on asserts
|
|
| Stránka: 1 z 1
| [ Príspevkov: 4 ] | |
Podobné témy | Témy | Odpovede | Zobrazenia | Posledný príspevok |
---|
| symbol $ a symbol @ v JavaScript, VBScript, Ajax | 5 | 306 | 16.11.2010 0:27 TommyHot | | PDA:Symbol MC50 v Mobilné zariadenia | 0 | 843 | 20.10.2007 0:54 Fireblade46 | | symbol zámku pri ikone v Sieťové a internetové programy | 1 | 541 | 15.02.2011 20:41 ViktorinoSK | | External HDD v Pevné disky a radiče | 16 | 512 | 03.01.2018 15:38 4040 | | External Cases v Ostatné zariadenia | 0 | 878 | 09.06.2008 9:52 KatjushaMan | | P: External cooling v Predám | 0 | 421 | 21.03.2011 15:23 spartakman1 | | Problem medzi Symbol Motorola MC9094 a PC cez USB kabel v Mobilné zariadenia | 2 | 726 | 26.12.2009 11:42 dandee | | Swap memory internal to external v Smartfóny a tablety | 6 | 498 | 28.07.2014 10:50 Phanteom | | I,P : ASUS EXTERNAL SLIM SDRW-08D3S-U v Predám | 0 | 255 | 22.11.2016 17:59 notfake | | EVGA GeForce GTX460 External Exhaust vs GIGABYTE N460OC-1GI v nVidia grafické karty | 2 | 489 | 24.05.2011 15:26 dKWt | | IBM External Half High LTO Gen 4 SAS Drive server v Predám | 1 | 252 | 02.06.2014 22:08 Miť0 | | I/P: External WD 2,5" Elements 500GB, USB 3.0 v Predám | 5 | 836 | 02.04.2014 15:25 Rainmaker | | Mám sa učiť C ++/objective C/ C#? v Assembler, C, C++, Pascal, Java | 5 | 733 | 08.07.2014 20:40 XOLOO | | rozdiel medzi Borland 3.1 C++ vs Net. C++ v Assembler, C, C++, Pascal, Java | 4 | 577 | 20.07.2010 12:54 walther | | Hledá se programátor C/C++ pro vesmírné projekty (Praha) v Ponuka práce | 0 | 1123 | 10.05.2016 14:59 evolvsys | | Hladam hracov na C&C Generals Zero Hour v Počítačové hry | 10 | 1250 | 07.03.2007 19:22 Spirit |
| Nemôžete zakladať nové témy v tomto fóre Nemôžete odpovedať na témy v tomto fóre Nemôžete upravovať svoje príspevky v tomto fóre Nemôžete mazať svoje príspevky v tomto fóre
|
|