以下のコードを使用してオブジェクトファイルをコンパイルしようとしています。Sun Studio 12を使用したSolaris SPARCへの移植
//--Begin test.cpp
class A;
void (A::* f_ptr)();
void test() {
A *a;
(a->*f_ptr)();
}
//-- End test.cpp
GNU g ++コンパイラでは、オブジェクトファイルをコンパイルすることができます。
$ g++ -c test.cpp
しかし、のSun Studio 12のためのSolaris 10(SPARC)には、エラーを出力します。
$ CC -c test.cpp
は、Sun Studio C++コンパイラは オブジェクトファイルを構築するために取得するためのコンパイラフラグはありますか?別の回避策がありますか?"test.cpp", line 7: Error: Cannot call through pointer to member function before defining class A.
1 Error(s) detected.