2013-02-23 2 views
-2

기호 재정의 문제가있는 c 프로그램을 컴파일 할 수 없습니다. 다양한 변수 데이터 유형 정의를 시도했지만 float 및 static float에 대해 여기에서 무슨 일이 벌어지고 있는지 이해할 수 없습니다. 그에게 좋은 기회를주었습니다. 행 번호와c 정적 플로트 오류 : '????'기호가 다른 종류의 기호로 다시 선언되었습니다.

 
problem with edge.c: In function ‘qc_edge’: 
edge.c:30:15: error: ‘kernel’ redeclared as different kind of symbol 
edge.c:23:77: note: previous definition of ‘kernel’ was here 

코드 조각 :

크리스

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

오류 메시지

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

답변

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}}; 
관련 문제