-2

ac プログラムをコンパイルできません。シンボルの再定義に問題があります。さまざまな変数データ型の定義を試しましたが、float と static float に関してここで何が起こっているのか理解できません。良いショットを与えてくれました。助けていただければ幸いです。

クリス

$ gcc -Wall -g -O6 -I../include -c -o edge.o edge.c

エラーメッセージ:

edge.c の問題: 関数 'qc_edge' 内:
edge.c:30:15: エラー: 'kernel' が別の種類のシンボルとして再宣言されました
edge.c:23:77: 注: 「カーネル」の以前の定義はここにありました

行番号付きのコード フラグメント:

18 //qc_edge (q, scan, start, gap, conv_kernel, 3, 3));
19 }
20
21 /******************************************************************/
22
23 scanbuf *qc_edge (struct qcam *q, scanbuf *scan, int start, int gap, float *kernel, int  
kernel_x, int kernel_y)
24 { scanbuf *scantmp;
25  int i;
26  int s, height, width,
27    grad;
28  float deltaX, deltaY;
29
30 static float kernel [3][3] = {{1, 2, 1},
32                    {2, -1, 2},
33                    {1, 2, 1}};
4

1 に答える 1

1
scanbuf *qc_edge (struct qcam *q, scanbuf *scan, int start, int gap, float *kernel, int  
kernel_x, int kernel_y)                                               ^^^^^^^^^^^^// pointer to float type

static float kernel [3][3] = {{1, 2, 1},  array of float.  So you cant have one variable with two declaration in same scope. try changing the variable name. 

試す:

24 { scanbuf *scantmp;
25  int i;
26  int s, height, width,
27    grad;
28  float deltaX, deltaY;
29
30 static float kernel_temp [3][3] = {{1, 2, 1},  <---- Change name
32                    {2, -1, 2},
33                    {1, 2, 1}};
于 2013-02-23T07:47:45.723 に答える