Sign in to follow this  

Compiler issues

Recommended Posts

I'm having issues with the compiler (Visual C++ / VS .NET 2003) not being able to handle header includes very well. I've got two classes... Circle and Polygon2D. The Polygon2D class contains a pointer to a Circle, and the Circle class contains a pointer to a Polygon2D. Obviously the Circle class includes the header file for Polygon2D, and vise-versa. The compiler doesn't like that. Circular reference or something, I presume. I get messages saying one of the classes doesn't exist. What's the best way to resolve this?

Share this post

Link to post
Share on other sites
try adding #prgama once
you should see it in VS generated files. I don't have VS handy so I can't tell you what they use exactly but it is something lilke that.

In most other compilers you use something like:
#ifndef FILENAME
#define FILENAME
stuff from file

this way files are only included once.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this