【问题标题】:c Static float error: ‘????’ redeclared as different kind of symbolc 静态浮点错误:“????”重新声明为不同类型的符号
【发布时间】:2013-02-23 07:43:48
【问题描述】:

无法编译 c 程序,符号重定义问题。尝试了各种变量数据类型定义,无法理解关于浮点数和静态浮点数的情况。给了它一个很好的机会,任何帮助表示赞赏。

克里斯

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

错误信息:

edge.c 的问题:在函数“qc_edge”中: edge.c:30:15:错误:“内核”重新声明为不同类型的符号 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}};

【问题讨论】:

    标签: c static-variables redefinition


    【解决方案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}};
    

    【讨论】:

      猜你喜欢
      • 2022-11-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-10-12
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多