また質問です。
17番目のソースをビルドするとエラーがでます
1章\mydat\source\cshot.cpp(56) : error C2039: 'shot_cnt' : 'ch_t' のメンバではありません。
1章\mydat\include\struct.h(2) : 'ch_t' の宣言を確認してください。
1章\mydat\source\cshot.cpp(57) : error C2039: 'shot_cnt' : 'ch_t' のメンバではありません。
1章\mydat\include\struct.h(2) : 'ch_t' の宣言を確認してください。
1章\mydat\source\cshot.cpp(65) : error C2039: 'shot_cnt' : 'ch_t' のメンバではありません。
と出てきます
'ch_t' の宣言とは
typedef struct{
int flag; //フラグ
int cnt; //カウンタ
int power; //パワー
int point; //ポイント
int score; //スコア
int num; //残機数
int mutekicnt; //無敵状態とカウント
int shot_mode; //ショットモード
int money; //お金
int img; //画像
int slow; //スローかどうか
double x,y; //座標
}ch_t;
のことですか?
それとも
//キャラクターショットに関する構造体
typedef struct{
int flag,power,cnt,knd;//フラグ、パワー、カウンタ、種類
double x,y,angle,spd;//座標、角度、スピード
}cshot_t;
こっちのほうですか?
教えてください
17番目のエラー
Re:17番目のエラー
---------------------------------------------------------------------------------------
1章\mydat\source\cshot.cpp(56) : error C2039: 'shot_cnt' : 'ch_t' のメンバではありません。
1章\mydat\include\struct.h(2) : 'ch_t' の宣言を確認してください。
---------------------------------------------------------------------------------------
エラーの通り構造体ch_tの宣言に問題があります。
(構造体ch_tの中に、"shot_cnt"という変数なんて存在しませんよ というエラーです。)
それぞれの変数はどのように使われているかは分かりませんが、
ともかくch_t構造体の中に、shot_cntという変数を追加すればいいと思います。
typedef struct{
int flag; //フラグ
int cnt; //カウンタ
int power; //パワー
int point; //ポイント
int score; //スコア
int num; //残機数
int mutekicnt; //無敵状態とカウント
int shot_mode; //ショットモード
int shot_cnt; //ショットのカウンタ(?)
int money; //お金
int img; //画像
int slow; //スローかどうか
double x,y; //座標
}ch_t;
1章\mydat\source\cshot.cpp(56) : error C2039: 'shot_cnt' : 'ch_t' のメンバではありません。
1章\mydat\include\struct.h(2) : 'ch_t' の宣言を確認してください。
---------------------------------------------------------------------------------------
エラーの通り構造体ch_tの宣言に問題があります。
(構造体ch_tの中に、"shot_cnt"という変数なんて存在しませんよ というエラーです。)
それぞれの変数はどのように使われているかは分かりませんが、
ともかくch_t構造体の中に、shot_cntという変数を追加すればいいと思います。
typedef struct{
int flag; //フラグ
int cnt; //カウンタ
int power; //パワー
int point; //ポイント
int score; //スコア
int num; //残機数
int mutekicnt; //無敵状態とカウント
int shot_mode; //ショットモード
int shot_cnt; //ショットのカウンタ(?)
int money; //お金
int img; //画像
int slow; //スローかどうか
double x,y; //座標
}ch_t;