Yet another one of those "Unidentified" problems..

Firstly, this is the code:

#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <ctype.h>
#include "stack.h"
#include "node.h"

using namespace std;

int main()
{
node *r;
postfix2exptree("6 2 - 2 /",&r);
cout << "Inorder = " << inorder(r);
cout << "\nPreorder = " << preorder(r);
cout << "\nPostprder = " << postorder(r);
cout << "\nResult = %d\n" << evaluatetree(r);
system("pause");
}

The error keeps on saying something like:

In function `int main()':|
|14|error: `postfix2exptree' undeclared (first use this function)|
|14|error: (Each undeclared identifier is reported only once for each function it appears in.)|
|15|error: `inorder' undeclared (first use this function)|
|16|error: `preorder' undeclared (first use this function)|
|17|error: `postorder' undeclared (first use this function)|
|18|error: `evaluatetree' undeclared (first use this function)|
||=== Build finished: 6 errors, 0 warnings ===|

Does anyone know how to help me? I am honestly stumped...
Okay, new problem! I was researching on what those errors meant. Someone said this "The compiler found a symbol that is being used but was not declared as a particular type of variable. The compiler therefore does not know how to treat it or what memory should be allocated for it. " So I meddled with the code a bit... It now looks like this:

#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <ctype.h>
#include "stack.h"
#include "node.h"

using namespace std;

int main()
{
node *r;
node.postfix2exptree("50 50 - 2 /",&r);
cout << "Inorder = " << node.inorder(r);
cout << "\nPreorder = " << node.preorder(r);
cout << "\nPostprder = " << node.postorder(r);
cout << "\nResult = %d\n" << node.evaluatetree(r);
system("pause");
}

BUUUT!!! there are now new errors popping up! this time its... wait for it! i feel so stupid already! its "14 expected primary-expression before '.' token ". The other lines are like that as well! I have honest to goodness no idea what's wrong! help please! thanks!
When you make a variable of type *r, you are creating a pointer to a node, so on the next lines, you are accessing "node" which doesn't exist. You would have to create a node object, point r to it, and then modify r (or just create the object and modify it)
Topic archived. No new replies allowed.