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;
}
}
}
ビルドすると以下の様にエラーが出ました; どこを直せばいいのでしょうか?
Re: ビルドすると以下の様にエラーが出ました; どこを直せばいいのでしょうか?
プログラムソースはBBCodeのcodeタグで囲っていただけるととっても見やすいです。
このエラーはそのままの意味でX_SIZEとY_SIZEの実態がどこにもないにも関わらず使おうとしているから起こっているエラーです
Params.hの中身が分からないのですが、もしX_SIZEとY_SIZEが書かれていないのであれば下記のような訂正で動作すると思います
このエラーはそのままの意味で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;
}
}
}
Re: ビルドすると以下の様にエラーが出ました; どこを直せばいいのでしょうか?
ここでマルチポスト(複数の掲示板で同じ質問をすること)をする場合は、相互リンクをしなければいけません。
複雑な問題?マシンの性能を上げてOpenMPで殴ればいい!(死亡フラグ)