【发布时间】:2013-10-27 21:29:45
【问题描述】:
我正在寻找混合树的实现(不重要),并找到一个“旧”的 here。
作者说他们已经在 SUN Sparc 平台(运行 Solaris 2.6)和 gcc-2.8.1 编译器上尝试过这段代码。而我的环境是gcc version 4.4.3(Ubuntu 10.10)。
问题是: 我使用他提供的 makefile 运行“make”,但它给了我很多错误消息,如下所示:
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。但我发现它是无穷无尽的。
所以我的问题是:是否有任何方便的方法来运行这个程序,无论是自动将此代码转换为“现代风格”还是使用独立的“旧风格”编译器?
有什么建议吗?
===更新:===
谢谢大家,我使用--prefix=/usr/local/gcc-2.8.1 将gcc2.8.1 安装在不同的目录中,并修改“makefile”以使用这个旧版本的gcc(/usr/local/gcc-2.8.1/bin/gcc)。但是当我运行“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 的这些头在哪里?
【问题讨论】: