I have the main .cpp file with this:
#include "stdafx.h"
#include "Form1.h"
#include <iostream>
...
#include <stdio.h>
const int MAX_LEN = 1000;
struct DataLine {
char StartCode;
int ByteCount;
int Address;
int RecType;
int DBytes[16];
int Checksum;
};
DataLine AllData[MAX_LEN];
Then I have a form.h with the following:
extern const int MAX_LEN;
extern struct DataLine AllData[MAX_LEN];
//later on in header file
AllData[index].Startcode = sc;
AllData[index].ByteCount = i_Byte_Count;
...
This will not compile giving a host of errors but the first is: 'DataLine *' : unknown size. Should I change certain things to typedef? I’m not really sure why its not liking this.
You can’t define
in the header file because
struct DataLineis completely unknown in the header file. Notypedefwill help you here. The definition ofstruct DataLinemust be present in the header file before you defineAllData. Move it there.