我正在寻找混合树的实现(不重要),并找到一个“旧”一个here。如何运行为旧编译器编写的程序?
笔者说,他们已经尝试了SUN的Sparc平台(运行的Solaris 2.6),并与GCC-2.8.1编译这个代码。我的环境是gcc版本4.4.3(Ubuntu 10.10)。
的问题是: 我跑“做”与他提供了生成文件,但它给了我很多的错误信息如下:
g++ -c Node.C
g++ -c DataNode.C
In file included from DataNode.h:18,
from DataNode.C:17:
Query.h:9:20: error: vector.h: No such file or directory
Query.h:10:19: error: stack.h: No such file or directory
Query.h:13:22: error: function.h: No such file or directory
Query.h:14:22: error: iostream.h: No such file or directory
DataNode.C:283:8: warning: extra tokens at end of #endif directive
In file included from DataNode.h:18,
from DataNode.C:17:
Query.h:29: warning: ‘typedef’ was ignored in this declaration
Query.h:44: warning: ‘typedef’ was ignored in this declaration
Query.h:86: error: expected initializer before ‘<’ token
Query.h:118: error: ISO C++ forbids declaration of ‘PQ’ with no type
Query.h:118: error: expected ‘;’ before ‘*’ token
Query.h:122: error: ISO C++ forbids declaration of ‘PQ’ with no type
Query.h:122: error: expected ‘;’ before ‘*’ token
Query.h:126: error: ISO C++ forbids declaration of ‘PQ’ with no type
Query.h:126: error: expected ‘;’ before ‘*’ token
Query.h:135: error: expected initializer before ‘<’ token
DataNode.C: In member function ‘void DataNode::DisconnectBranch(int)’:
DataNode.C:80: error: ‘memmove’ was not declared in this scope
make: *** [DataNode.o] Error 1
我知道我需要修改的烃源代码,以便与现代编译器一致,如更改vector.h
至vector
。但我觉得这只是无穷无尽的。
所以我的问题是:是否有任何convienent方法来运行此程序,无论将此代码自动转换为“现代风格”还是使用独立的“旧式”编译器?
有什么建议吗?
=== 更新: ===
谢谢大家,我用--prefix=/usr/local/gcc-2.8.1
和修改 “Makefile文件” 要使用本老版本的GCC(/usr/local/gcc-2.8.1/bin/gcc
)安装gcc2.8.1在不同的目录。但是,当我运行“make”,但它仍然给了我找不到头的错误:
/usr/local/gcc-2.8.1/bin/gcc -c DataNode.C
In file included from DataNode.h:18,
from DataNode.C:17:
Query.h:9: vector.h: No such file or directory
Query.h:10: stack.h: No such file or directory
Query.h:11: deque: No such file or directory
Query.h:12: algorithm: No such file or directory
Query.h:13: function.h: No such file or directory
Query.h:14: iostream.h: No such file or directory
make: *** [DataNode.o] Error 1
然后我试图使用find /usr/local/gcc-2.8.1 -name "*vector*"
找到/usr/local/gcc-2.8.1这些头,但一无所获。
那么这些老版本gcc的头在哪里呢?
他特别要求解决方案,而不是重命名标题。 – 2011-12-29 15:12:23
另外,重命名头文件甚至没有接近尾部。如果你走这条路线,你也必须担心命名空间 - 例如''将所有东西放在'std'中,而''不放。 –
cHao
2011-12-29 15:21:58