Advertisement

OK - Another question - (Bored of me yet ??!!)

Started by August 01, 2002 10:15 AM
1 comment, last by SteveBe 22 years, 3 months ago
Now my game is finished and working smoothly thanks to you guys. What I want to know now is this. In my code window I''ve got the main function with all of my other functions listed underneath it. It looks kind of messy. Is there anyway of keeping each individual function in a separate file for portability and for neatness. Then obviously I just want to compile as normal for one .exe file. I''m using Dev C++ if that helps any of you in answering me.
i don''t know your IDE, but you can seperate your code into multiple files. put your function declarations in a .h-file, and put your definition in a .cpp file. then #include your "headerfile.h" in your cpp-files where you need the functions.
Advertisement

yes... this is entirely possible although it is most definitely not advised. Each function in its own file would lead to too much build time overhead, and too much fragmentation of the source IMO. However you should (again IMO) break up similar functions into seperate files, just do it intelligently so that it becomes easier to deal with than staring at a large block of code, and it is not overly done...

btw, you will need to make header files for each of the c/cpp files so that the functions/vars/classes/etc can be included in the other pieces of the program... having too many of these header files (each c/cpp needs one) would get to be exceedingly tiresome to deal with.

Good Luck.

( Is it a wizard''s hat as the mod said, or is it a traffic cone? Oh yeah pylon... thats the word It''s got to be a pylon... stupid mod )

This topic is closed to new replies.

Advertisement