Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Drath

Spreading code over multiple cpp files

This topic is 5842 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

I am a begginer to c++ though not to programming in general. One problem I have run in to is how to access a something from one source code to another. In functions, I set the object as a parameter then access it with relative ease but if I have my own object: typedef struct tagCam { float xpos, ypos, zpos; float yrot, lookupdown; } CAM; I have had to place it in both files for CAM to be detected. How can I do it so that I need only to place it in one? Is it through header files? If so I will need a little explaining... Thanks...

Share this post


Link to post
Share on other sites
Advertisement
put the struct in a header file (cam.h) and in the source file you use #include in the top.

#include "cam.h"

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!