我正在编写一个 C 程序,其中使用 header 来声明一些函数并定义几个常量。当我在代码中使用这些常量时,出现错误无法解析符号“FOO”
。我对声明的函数没有任何问题。
我正在使用 Eclipse Neon。我已经验证包含头文件的目录路径已添加到“包含路径”中。我还重新启动了 Eclipse。
标题.h
#ifndef __header_h_
#define __header_h_
#define FOO 0x00
#define BAR 0x01
void do_stuff(int x);
#endif
main.c
#include <stdio.h>
#include "header.h"
int main() {
do_stuff(FOO);
return 0;
}
ERROR: Symbol 'FOO' could not be resolved
我在这里缺少什么?
最佳答案
右键单击项目索引>刷新所有文件
,然后索引>重建
解决了问题
关于c - 无法解析 header 中定义的 Eclipse C 常量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57474379/