game.h needs: - packet.h - socket.h socket.h needs: - game.h
The problem comes when I try to include socket.h into game.h, because socket.h has game.h included already. How do I solve these kind of problems?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The usual way, use #ifdef and #define in your header files
inside game.h:
This way, the contents will be read multiple times, but only defined once.
Edit: Removed underscores at start and end of identifier per comments.