• Advertisement
Sign in to follow this  

C++ Linker resources

This topic is 4228 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey all. So after 4 years of Java in College, and year of writing perl for web based apps, I'm trying to get back into C++. It's actually going fairly smoothly, as I build up a simple pong clone. Most things I can either figure out, or use cplusplus.com to reference. The one thing that seems to give me trouble is the linker though. Are there any good references on best practices for how to include files, when to use inclusion guards ect? For example, I have a 2D Vector class. I also have a GameActor.h file (containing a GameActor class) that #includes the "Vect2d.h", and a Main.cpp file that #includes the "Vectd.h." Right now main.cpp is used as more of a scratch pad to test classes as I build them. When I put an inclusion guard on "Vect2d.h" my GameActor can't seem to see the vect2D class. If I leave it off it works fine. I've been told that you want inclusion guards on any file you include in other files, but this seems to contradict that ;). So any advice on where to learn about best practices for how I set up my Header and CPP files so as not to make my compiler (VC++ .net 2003) cry? Char

Share this post


Link to post
Share on other sites
Advertisement
Yeah, these sort of problems are very confusing, and I have found that many Cpp instructional books never explain how to organise multiple source files and/or fix linker errors... HERE is a great article hosted on this site that has helped me to understand the situation and fix loads of problems.

Share this post


Link to post
Share on other sites
Brilliant! thanks for your help. Not sure if that solves my problem, but it brings me much closer to understanding the issues.

Char

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement