【发布时间】:2023-03-06 08:20:01
【问题描述】:
我有一个自定义头文件 ("strings.h"):
#ifdef __cplusplus
#if __cplusplus
extern "C"{
#endif
#endif /* __cplusplus */
#include "sdkGlobal.h"
#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif /* __cplusplus */
#if !defined administration_H_
#define administration_H_
#define POS_STR_TITLE_OPERATIONS "somestr"
#endif
在我拥有的一个源文件中:
#include "../inc/strings.h"
在我使用时的代码中:
sdkShow (LINE3, 0, POS_STR_TITLE_OPERATIONS );
我得到错误:
src/main.c: In function 'postMainMenu':
src/main.c:190: error: 'POS_STR_TITLE_OPERATIONS ' undeclared (first use in this function)
src/main.c:190: error: (Each undeclared identifier is reported only once
src/main.c:190: error: for each function it appears in.)
make[1]: *** [src/main.o] Error 1
make: *** [all] Error 2
有什么想法吗?
【问题讨论】:
-
您是否尝试过明确指定头文件的路径?你的代码在哪个目录执行?
标签: c header-files c-preprocessor undeclared-identifier