incomplete type in nested name specifier エラー

以下のようなコード(StackOverFlow より)は C++ ではエラーが出る。

class A;

int b= A::c; // error: incomplete type ‘A’ used in nested name specifier

class A {
    static const int c=5;
};

当たり前と思われる人もいるかもしれないが、ライブラリを多数使っている場合、なかなか原因に気がつかない。

 

クリックclose

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です