構造体のインスタンスである静的定数変数をクラスに追加しようとしています。それは静的なので、私はははクラス宣言でそれを初期化する必要があります。私はそれをどのように初期化しないC++静的const構造体変数の初期化
error: a brace-enclosed initializer is not allowed here before '{' token
error: invalid in-class initialization of static data member of non-integral type 'const timespec'
:このエラーを取得、このコード
class Game {
public:
static const struct timespec UPDATE_TIMEOUT = { 10 , 10 };
...
};
をしようとすると?ありがとう!
精巧な型指定子( 'struct timespec')は、C++ではほとんど必要ないことに注意してください。 timespecを書くだけです。 – GManNickG