Including a .cc
file in another .cc
file is indicative of unclean design.
You can conditionally compile in/out portions of the code in main.cc
and batterysaver.cc
based on whether BATTERY
has been defined or not.
If that doesn't work, you have to ask yourself how you can put common declarations in a .h
file and include the .h
file in both the .cc
files.
my_common.h
#ifndef MY_COMMON_H
#define MY_COMMON_H
//standard header
#include "pebble.h"
#include "iota.h"
#define BATTERY false
//app-specific data
extern Window *window; //obvious window is obvious
extern TextLayer *time_layer; //time layer
#ENDIF
main.cc
#include "my_common.h"
Window *window; //obvious window is obvious
TextLayer *time_layer; //time layer
#if !BATTERY
*REST OF FILE STARTS HERE, THEN AT THE END*
#endif
battarysaver.cc
#include "my_common.h"
#if BATTERY
*REST OF FILE STARTS HERE, THEN AT THE END*
#endif