ビルドすると以下の様にエラーが出ました; どこを直せばいいのでしょうか?

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

ビルドすると以下の様にエラーが出ました; どこを直せばいいのでしょうか?

#1

投稿記事 by SY » 9年前

visual studio 2013 を使っています、拡大・縮小(最近傍法)のプラグラミングを入力してビルドすると以下の様にエラーが出ました;
どこを直せばいいのでしょうか?

1> Source.cpp
1>c:\users\ogura\documents\visual studio 2013\projects\consoleapplication19\consoleapplication19\source.cpp(9): error C2065: 'Y_SIZE' : 定義されていない識別子です。
1>c:\users\ogura\documents\visual studio 2013\projects\consoleapplication19\consoleapplication19\source.cpp(9): error C2065: 'X_SIZE' : 定義されていない識別子です。
1>c:\users\ogura\documents\visual studio 2013\projects\consoleapplication19\consoleapplication19\source.cpp(10): error C2065: 'Y_SIZE' : 定義されていない識別子です。
1>c:\users\ogura\documents\visual studio 2013\projects\consoleapplication19\consoleapplication19\source.cpp(10): error C2065: 'X_SIZE' : 定義されていない識別子です。
1>c:\users\ogura\documents\visual studio 2013\projects\consoleapplication19\consoleapplication19\source.cpp(13): error C2065: 'X_SIZE' : 定義されていない識別子です。
1>c:\users\ogura\documents\visual studio 2013\projects\consoleapplication19\consoleapplication19\source.cpp(14): error C2065: 'Y_SIZE' : 定義されていない識別子です。
========== ビルド: 0 正常終了、1 失敗、0 更新不要、0 スキップ ==========



#include "Params.h"

/*--- scale_near --- 拡大縮小(最近傍法)--------------------------------------
image_in: 入力画像配列
image_out: 出力画像配列
zx: 拡大率(横)
zy: 拡大率(縦)
-----------------------------------------------------------------------------*/
void scale_near(unsigned char image_in[Y_SIZE][X_SIZE],
unsigned char image_out[Y_SIZE][X_SIZE], float zx, float zy)
{
int i, j, m, n;
int xs = X_SIZE / 2;
int ys = Y_SIZE / 2;

for (i = -ys; i < ys; i++) {
for (j = -xs; j < xs; j++) {
if (i > 0) m = (int)(i / zy + 0.5);
else m = (int)(i / zy - 0.5);
if (j > 0) n = (int)(j / zx + 0.5);
else n = (int)(j / zx - 0.5);
if ((m >= -ys) && (m < ys) && (n >= -xs) && (n < xs))
image_out[i + ys][j + xs] = image_in[m + ys][n + xs];
else
image_out[i + ys][j + xs] = 0;
}
}
}

Referia
記事: 24
登録日時: 9年前
住所: 奈良

Re: ビルドすると以下の様にエラーが出ました; どこを直せばいいのでしょうか?

#2

投稿記事 by Referia » 9年前

プログラムソースはBBCodeのcodeタグで囲っていただけるととっても見やすいです。

このエラーはそのままの意味でX_SIZEとY_SIZEの実態がどこにもないにも関わらず使おうとしているから起こっているエラーです
Params.hの中身が分からないのですが、もしX_SIZEとY_SIZEが書かれていないのであれば下記のような訂正で動作すると思います

コード:

#include "Params.h"

// X軸の大きさ
#define X_SIZE 10
// Y軸の大きさ
#define Y_SIZE 10

/*--- scale_near --- 拡大縮小(最近傍法)--------------------------------------
image_in: 入力画像配列
image_out: 出力画像配列
zx: 拡大率(横)
zy: 拡大率(縦)
-----------------------------------------------------------------------------*/
void scale_near(unsigned char image_in[Y_SIZE][X_SIZE],
	unsigned char image_out[Y_SIZE][X_SIZE], float zx, float zy)
{
	int i, j, m, n;
	int xs = X_SIZE / 2;
	int ys = Y_SIZE / 2;

	for (i = -ys; i < ys; i++) {
	for (j = -xs; j < xs; j++) {
	if (i > 0) m = (int)(i / zy + 0.5);
	else m = (int)(i / zy - 0.5);
	if (j > 0) n = (int)(j / zx + 0.5);
	else n = (int)(j / zx - 0.5);
	if ((m >= -ys) && (m < ys) && (n >= -xs) && (n < xs))
	image_out[i + ys][j + xs] = image_in[m + ys][n + xs];
	else
	image_out[i + ys][j + xs] = 0;
	}
	}
}


アバター
みけCAT
記事: 6734
登録日時: 13年前
住所: 千葉県
連絡を取る:

Re: ビルドすると以下の様にエラーが出ました; どこを直せばいいのでしょうか?

#4

投稿記事 by みけCAT » 9年前

ここでマルチポスト(複数の掲示板で同じ質問をすること)をする場合は、相互リンクをしなければいけません。
複雑な問題?マシンの性能を上げてOpenMPで殴ればいい!(死亡フラグ)

閉鎖

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