17番目のエラー

フォーラム(掲示板)ルール
フォーラム(掲示板)ルールはこちら  ※コードを貼り付ける場合は [code][/code] で囲って下さい。詳しくはこちら
デラ初心者

17番目のエラー

#1

投稿記事 by デラ初心者 » 16年前

また質問です。
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;
こっちのほうですか?

教えてください

conio

Re:17番目のエラー

#2

投稿記事 by conio » 16年前

---------------------------------------------------------------------------------------
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;

デラ初心者

Re:17番目のエラー

#3

投稿記事 by デラ初心者 » 16年前

回答ありがとうございます

おかげでできました
有り難うございます

閉鎖

“C言語何でも質問掲示板” へ戻る