0

1994 年に UNIX 用に作成されたコードの Windows 実行可能ファイルが必要です。私はcygwin環境からこれをやろうとしました。今回から C++ 標準が変更され、標準ライブラリも変更されました。

-std= および -traditional-cpp オプションを使用しようとしましたが、そのオプションはまったく役に立ちませんでした。また、-fno-for-scope と -fno-operator-names を使用すると、エラーの数が減ることもわかりました。また、入出力ライブラリも当時から大幅に変更されました。また、事前定義された (プリプロセッサによる) マクロも当時から変更されている可能性があると思います。

コードに関する著者のメモ:
http://research.microsoft.com/en-us/um/people/hoppe/code.htm

4

3 に答える 3

1

ライブラリ (library/linpack および library/recipes) 内の C コードは、次を使用して正常にコンパイルされます。

gcc -c *.c

C++ コードはさらに問題があります。../include にはヘッダーがあり、関数プロトタイプを生成するには -DANSI が必要です。それらはextern "C"ヘッダーで宣言されていません。これらは、C++ ソース ディレクトリのヘッダーに正しく含まれています。

extern "C" {
#include "linpack.h"
}

したがって、A3dStream.C をコンパイルすると、次のようになります。

$ g++ -DANSI -I../include -c A3dStream.C
In file included from /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/backward/iostream.h:31,
                 from Hh.h:12,
                 from A3dStream.C:4:
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/backward/backward_warning.h:32:2:
warning: #warning This file includes at least one deprecated or antiquated header.
Please consider using one of the 32 headers found in section 17.4.1.2 of the C++
standard.    Examples include substituting the <X> header for the <X.h> header for
C++ includes, or <iostream> instead of the deprecated header <iostream.h>. To disable
this warning use -Wno-deprecated.
In file included from A3dStream.C:4:
Hh.h:15:23: strstream.h: No such file or directory
In file included from A3dStream.C:4:
Hh.h:45: error: declaration of C function `void bzero(void*, int)' conflicts with
/usr/include/string.h:54: error: previous declaration `void bzero(void*, size_t)' here
Hh.h:46: error: declaration of C function `int gethostname(char*, int)' conflicts with
/usr/include/sys/unistd.h:206: error: previous declaration `int gethostname(char*, size_t)' here
Hh.h:98: error: an explicit specialization must be preceded by 'template <>'
Hh.h:105: error: an explicit specialization must be preceded by 'template <>'
Hh.h:111: error: an explicit specialization must be preceded by 'template <>'
Hh.h:221: error: new declaration `void unsetenv(const char*)'
/usr/include/cygwin/stdlib.h:26: error: ambiguates old declaration `int unsetenv(const char*)'
In file included from Geometry.h:10,
                 from A3dStream.h:7,
                 from A3dStream.C:5:
Array.h: In member function `void Array<T>::resize(int)':
Array.h:40: error: `size' undeclared (first use this function)
Array.h:40: error: (Each undeclared identifier is reported only once for each function it appears in.)
Array.h:44: error: `a' undeclared (first use this function)
Array.h: In member function `void Array<T>::clear()':
Array.h:51: error: `a' undeclared (first use this function)
Array.h:51: error: `size' undeclared (first use this function)
Array.h: In member function `void Array<T>::init(int)':
Array.h:53: error: `size' undeclared (first use this function)
Array.h: In member function `void Array<T>::need(int)':
Array.h:57: error: `size' undeclared (first use this function)
Array.h: In member function `Array<T>& Array<T>::operator+=(const T&)':
Array.h:64: error: `a' undeclared (first use this function)
Array.h: In member function `void Array<T>::squeeze()':
Array.h:66: error: `size' undeclared (first use this function)
Array.h: In member function `const T& Array<T>::operator[](int) const':
Array.h:70: error: `a' undeclared (first use this function)
Array.h: In member function `T& Array<T>::operator[](int)':
Array.h:71: error: `a' undeclared (first use this function)

他のファイルでも同様のエラーが発生します。

Windows XP の Cygwin で GCC 3.4.4 を使用しています。

私は C++ の第一人者ではありませんが、ソフトウェアの考古学についてはかなりの割合を占めていますが、特に strstream.h が欠落しているため、C++ 標準ヘッダーを使用するようにコードを更新する必要があるようです (つまり、名目上は、代わりに使用<strstream>)、つまり、std名前空間などを処理する必要があります。このコードは標準より 5 年も前の日付になっているため、最新の状態にするためにハードにハッキングする必要があるのは不合理ではありません。

幸運を!

于 2009-01-14T08:01:47.507 に答える
0

gcc 2.7.0 のソースは、引き続き GNU Web サイトからダウンロードできます。

古いバージョンのコンパイラをダウンロードして作成できます。

于 2009-01-14T08:31:50.287 に答える
0

2 つの可能性が考えられます。AT&T は、UWIN (同じ問題を回避するために Cygwin とは十分に異なる可能性があります) と古いバージョンの CFrontのソース(おそらく使用されている元のコンパイラー) の両方を提供しています。

3 つ目の可能性があります。これが推奨されるアクションだと思います。ソースを編集して、標準に合わせて最新の状態にすることです。このコードをさらに開発するつもりなら、遅かれ早かれ弾丸を噛むのが最善です。

于 2009-01-14T08:14:20.650 に答える