Advertisement

Linking CPP files in VC++

Started by May 02, 2000 02:36 PM
1 comment, last by zippo 24 years, 6 months ago
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
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
Visit our homepage: www.rarebyte.de.stGA
Advertisement
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
---------- JonHobson ----------

This topic is closed to new replies.

Advertisement