junk.h
Code:
#ifndef JUNK_H_#define JUNK_H_
char r_getVersion[TRANSMIT_SIZE] = {'E','R','_','C','M','D','#','T','3'};
struct s_rf{
char command[10];
boolean ack;
};
void configRadio(void);
#endif /* JUNK_H_ */
junk2.h
Code:
#include <stdint.h>#include <stdlib.h>
#ifndef JUNK2_H_
#define JUNK2_H_
#define TRANSMIT_SIZE 9
typedef enum {F, T} boolean;
#endif /* JUNK2_H_ */
junk.c
Code:
#include <string.h>#include "junk.h"
#include "junk2.h"
void config(void)
{
extern char length;
extern char *cmd;
extern struct s_rf s_LPRS;
length = sizeof(r_getVersion);
cmd = memcpy(s_LPRS.command, r_getVersion, length);
s_LPRS.ack = T;
}
main.c
Code:
#include <string.h>#include "junk2.h"
#include "junk.h"
struct s_rf s_LPRS, *pyld;
char *cmd, length;
int main(void)
{
cmd = memcpy(s_LPRS.command, r_getVersion, sizeof(r_getVersion));
s_LPRS.ack = T;
pyld = &s_LPRS;
config();
}
I get undefined TRANSMIT_SIZE and boolean when I compile....If I include junk2.h within junk.h I then get r_getVersion has been redefined error....defined in junk.obj then redefined in main.obj. Can someone please show me how to set up these four files to be error free? Also I was under the impression that you should NOT include a .h file within another .h, is this correct?
Thank you