Jump to content
  • Advertisement

Archived

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

zippo

Linking CPP files in VC++

This topic is 6931 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 know this must sound like a stupid question, but how, if possible, do you link CPP files in a VC++ workspace? I mean to say, you can create header files, then include them in your cpp file and use the functions contained in it, but can you go through a cpp file, then have it go on to the next one in succession? I find that this would make the code a lot more organized, as the program(s) I would like to create would be a bit lenghtly. Linking these files would allow for me to move from file to file as the game progresses. Once again, I''m sure there''s an extremely simple answer to this (probably), but don''t have any documentation on VC with me at the moment. So, any responses would be more than welcomed. Thanks! zippo

Share this post


Link to post
Share on other sites
Advertisement
Try #include "previous.cpp".
I don''t know if that works, but I think usually the C preprocessor just removes the #include and fills in the contents of the included files instead.

Visit our homepage: www.rarebyte.de.st

GA

Share this post


Link to post
Share on other sites
Do you mean that you want to just break up a large function into small files? If so then I think the preprocessor would do that for you, but I've never seen any code that does that before.

I presume that you want to split your code by putting different functions in different .cpp files, You can do this by putting your function prototype in the file you want to call the function from, then put the fuction body in a new .cpp file. Now go to the project menu -> add to project -> Files, then select your .cpp file and it will be added to your project. You can now call the functions in the other file from any file that has the function's prototype.

-- Jon Hobson --

Edited by - JonHobson on 5/2/00 4:41:34 PM

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!