我有两个 C 文件,一个叫main.c另一个batterysaver.c. 我不想将我在文件中的代码包含在batterysaver.c文件main.c中并使用条件编译,而是希望有两个单独的文件,但能够在给定预处理器指令的情况下设置编译哪个文件。这可能吗?
这是main.c文件的标题:
//standard header
#include "pebble.h"
#include "iota.h"
#define BATTERY false
//app-specific data
Window *window; //obvious window is obvious
TextLayer *time_layer; //time layer
#if !BATTERY
*REST OF FILE STARTS HERE, THEN AT THE END*
#endif
这是batterysaver.c文件的标题:
#include "main.c"
#if BATTERY
*REST OF FILE STARTS HERE, THEN AT THE END*
#endif
我感谢任何和所有的帮助。