How do I get cpp files to interact with other cpp files? Like, say if I make a massive game, how do I use multiple cpp files together?
How do I get cpp files to interact with other cpp files? Like, say if I make a massive game, how do I use multiple cpp files together?
What platform are you building your game in? I think you would include the needed header files that encapsulates the source files, then build it together in a single project.
Visual C++
In Visual C++ you have "solutions" which contain "projects" which then contain, well, whatever is necessary. So you would make one project with a lot of .cpp files in it.
Why are we talking about dll's all of a sudden?
That's ... interesting. It takes real work to get a DLL, whereas it takes no work at all to get a normal executable. (File -> New Project -> (whatever kind of project you want); add all the source files to the project by right-clicking on the name of the project; hit F7 and you're done.)
Well.. at least tell me how executables grab dlls
I'd say at this point you're not ready to write a massive game. You need to get a basic book on C++ that explains these things.
Or, perhaps, Help -> Contents and go through some walkthroughs, or the "getting started" tour.
#include the corresponding header file (.h) in the .cpp file, or in another .cpp file.
.cpp files are simply there to contain the code of what you have declared in a .h file, so it doesn't make sense to include the .cpp files. The header files are your interface.
Like MarkZWEERS suggested:
// header file
// .cpp fileCode:#ifndef FOO_H #define FOO_H class Foo { public: Foo(); }; #endif
Code:#include "foo.h" #include <iostream> int main() { Foo fo; return 0; }
Double Helix STL