Jump to content

  • Log In with Google      Sign In   
  • Create Account


why do I see more than one *.cpp file?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
9 replies to this topic

#1 YodaTheCoder   Members   -  Reputation: 122

Like
Likes
Like

Posted 25 November 2001 - 11:27 AM

Why, why, why do people have more than one .cpp file? I thought you were only supposed to have 1!!! whywhywhywhy!?!?!?? like, I see stuff like main.cpp camera.cpp tex.cpp ah! Why does that help? does it even? ..thanks

Sponsor:

#2 AdmiralBinary   Banned   -  Reputation: 100

Like
Likes
Like

Posted 25 November 2001 - 11:29 AM

It helps.

---------------

I finally got it all together...
...and then forgot where I put it.

#3 meZmo   Members   -  Reputation: 122

Like
Likes
Like

Posted 25 November 2001 - 11:29 AM

Is this a trick-question...?

#4 Null and Void   Moderators   -  Reputation: 1087

Like
Likes
Like

Posted 25 November 2001 - 11:30 AM

1) No, you''re not "supposed to have 1".
2) It''s good for organization.
3) It helps (re)compile times dramatically with larger projects.

[Resist Windows XP''s Invasive Production Activation Technology!]

#5 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 25 November 2001 - 11:30 AM

Well, big, professional projects have 100s-thousands of lines of code (really big projects can go into several million lines of code). You don''t want to have 500000 lines of code in a single file, would you ? Would be a bit chaotic....



#6 AdmiralBinary   Banned   -  Reputation: 100

Like
Likes
Like

Posted 25 November 2001 - 11:34 AM

OK, to elaborate:

It is considered "good OOP practice" to declare a class in a .h file and provide the implementation in a .cpp file of the same name. This helps you to navigate the project and find things easily. Also, it means that if you change one .cpp file, the compiler does not have to recompile all the rest of them to get the program running again. FI, with v12 engine, first build takes about 20mins. After that, you change one or two things in one .cpp file and it only takes about 5secs to compile it again. Now imaging all the source was in one file. Hehe, I think u get my drift. Anyway, hope that helps clear things up 4 u.

---------------

I finally got it all together...
...and then forgot where I put it.

#7 YodaTheCoder   Members   -  Reputation: 122

Like
Likes
Like

Posted 25 November 2001 - 11:34 AM

so 20 .cpp files is like , all the same file really?

#8 AdmiralBinary   Banned   -  Reputation: 100

Like
Likes
Like

Posted 25 November 2001 - 11:35 AM

P.S. I started writing that second post right after my first one. Sorry, didn''t notice other replies.

---------------

I finally got it all together...
...and then forgot where I put it.

#9 AdmiralBinary   Banned   -  Reputation: 100

Like
Likes
Like

Posted 25 November 2001 - 11:35 AM

Yoda: Yeah, sort of.

---------------

I finally got it all together...
...and then forgot where I put it.

#10 Zeus_   Members   -  Reputation: 122

Like
Likes
Like

Posted 27 November 2001 - 03:50 AM

www.pokemon.com





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS