Can build my code on another linux-pc

Hi everyone.
I have currently coded a program in c++ on one (ubuntu) computer.
The program works fine (a few warnings, but nothing else).

I now try to build the code on another ubuntu computer. But this is giving problems. When i build it gives 5 problems.

The makefile is a generated file by eclipse.

The g++ compiler on the pc's is different (v. 4.6.1 on pc i coded on. V. 4.7.2 on the pc i try to build on). But is that really the problem?

Any have a idea what to look at?
Look at the 5 problems.
He he. Yeah that would be smart. But the errors occour in a data structure which i have not coded myself.
Im very sure i cant solve them.

The code, which i use (and i have not implemented myself) does not either work if i make its own project with it.

But you are welcome to see if you can fix it. The code can be found here https://dl.dropbox.com/u/1012230/DynTree.zip

My compiler error is as follow:



22:51:51 **** Build of configuration Debug for project DynTree ****
make all 
Building file: ../sttrees/st_splay.cpp
Invoking: GCC C++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"sttrees/st_splay.d" -MT"sttrees/st_splay.d" -o "sttrees/st_splay.o" "../sttrees/st_splay.cpp"
In file included from ../sttrees/stsplaynode.h:16:0,
                 from ../sttrees/st_splay.h:19,
                 from ../sttrees/st_splay.cpp:10:
../sttrees/../general/bintree.h: In instantiation of ‘void BinaryTree::rotateLeft(Node*) [with Node = STSplayNode]’:
../sttrees/stsplaynode.h:172:39:   required from here
../sttrees/../general/bintree.h:75:3: error: ‘linkLeft’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
../sttrees/../general/bintree.h:131:36: note: ‘template<class Node> void BinaryTree::linkLeft(Node*, Node*)’ declared here, later in the translation unit
../sttrees/../general/bintree.h: In instantiation of ‘void BinaryTree::rotateRight(Node*) [with Node = STSplayNode]’:
../sttrees/stsplaynode.h:173:35:   required from here
../sttrees/../general/bintree.h:62:3: error: ‘linkRight’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
../sttrees/../general/bintree.h:136:36: note: ‘template<class Node> void BinaryTree::linkRight(Node*, Node*)’ declared here, later in the translation unit
make: *** [sttrees/st_splay.o] Error 1

22:51:51 Build Finished (took 359ms)

Last edited on
Has just downgraded my compiler by using:

sudo apt-get install gcc-4.6
sudo apt-get install g++-4.6
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.6 20
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.6 20
sudo update-alternatives --config gcc
sudo update-alternatives --config g++

And now it works... But would be better if it worked at newer versions of g++.
Put the prototypes at the top. You are trying to use things that are not defined.
1
2
3
4
//  general/bintree.h
namespace BinaryTree {
	template <class Node> inline void linkLeft (Node *p, Node *n);
	template <class Node> inline void linkRight (Node *p, Node *n);
Wow that was amazing.
A easy bug. Really thanks a lot.

Would never have found that bug. It is just so impossible to debug when it is others code - and a new language.

You are amazing.
Topic archived. No new replies allowed.