Hello,
Please view the simple code below. I am trying to forwards declare pc. But I would like to typedef the forwards declaration so I don't have to repeat the "struct" key word every time I want to pass a pointer of pc type.
Thanks in advance.
Code:
========main.c (does nothing)
#include <stdio.h>
#include "PC.h"
#include "REC.h"
int main()
{...}
===========PC.h
#ifndef PC_H
#define PC_H
#include "REC.h"
typedef struct tag_pc {
unsigned short gso_flash_address;
} pc;
#endif // PC_H //
==========PC.c
#include <stdio.h>
#include "PC.h"
// Methods here...
==========REC.h
#ifndef REC_H
#define REC_H
//struct tag_pc; // Forwards declaration using the struct key word
typedef struct tag_pc pc; // <<< ?????? How to forward declare using typedef
typedef struct tag_rec_data{
unsigned short LKdct__F1;
}rec_data;
typedef struct tag_rec {
unsigned short f__pc_xchoice;
rec_data *records;
}rec;
int REC_match_link_id(pc *pObj); //<< error here
#endif // REC_H //
=============REC.c
#include <plib.h>
#include "PC.h"
#include "REC.h"
int REC_match_link_id(pc *pObj) {...} // <<<<error here!