#include "list.h"
#include "colorcube.h"
#ifndef LOCATIONREC_H
#define LOCATIONREC_H
struct LocationRec
{
short row;
short col;
short depth;
};//end LocationRec
#endif
#include <iostream>
#include <string>
usingnamespace std;
void main()
{
}//end main
I have this code and cannot get it to compile. LocationRec is a header file included in colorcube.h and list.h. I have tried moving the ifndef everywhere I can think of to no avail. This is the first time we've used an ifndef and this is how our teacher wants it done in our project, I'm just not sure where it goes in the code or if I'm doing it right.
In any file you plan to #include in your code (usually headers), place #ifndef/#define at the first two lines of the file, and put the matching #endif at the very last line
I put everything from the #ifndef to the #endif in locationrec.h (which is the header file included in both colorcube.h and list.h) and took it out of the client, and it compiles with no errors now. Thank you.