我正在尝试使用以下代码编译目标文件。使用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
但对于太阳录音室12在Solaris 10(SPARC),它输出一个错误。
$ CC -c test.cpp
"test.cpp", line 7: Error: Cannot call through pointer to member function before defining class A.
1 Error(s) detected.
是否有一个编译器标志得到了Sun Studio C++编译器来构建 目标文件?是否有另一种解决方法?