已解决。
我试图在 IAR Embedded Workbench(使用 STM32F303xC 微 Controller )中控制变量的值。我将 library.h 文件中的变量声明为:
extern int my_variable1;
extern float another_variable //... etc
然后在library.c中
int my_variable1 = 15;
float another_variable = 328.47;
在主程序中
my_variable1 = 38;
another_variable = pow(10,2) + another_variable/8
但在 watch、live watch 和 quick watch 中它会出现错误:(第 1 列)未知或不明确的符号。
我用这个 IDE 编写了几个程序,静态变量的声明有效,它允许我使用 watch 查看变量的值。在其他程序中,我将变量声明为
int my_variable1;
在主文件中,在主函数之外,它也能正常工作。
我该如何解决这个错误?
就我们而言,真正的问题似乎是:
有一种方法可以在 IAR Embedded Workbench 中显示 .c-s 之间共享的变量值吗?
最佳答案
作为一种优化形式,IDE Embedded Workbench 不会分配已声明但未使用的变量。因此这些变量无法在 watch 中显示。
关于c - IAR 嵌入式工作台 : Unknown or ambiguous symbol,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35582227/