Sign in to follow this  

multiple cpp files

This topic is 4480 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

Hey guys, i never acctually paid much attention to the use of multiple cpp files, but anyhoo i use multiple headers, however recently thought i would be alot better in my current project with multiple cpp files, how can i achieve this.

Share this post


Link to post
Share on other sites
How to do it depends on your development environment and how you are compiling and linking your files.

If you're using Visual Studio, it's as simple as just adding another source file to your project. If you're using something like gcc - just add the other source file to the arguments string (so, gcc source1.cpp source2.cpp -o executable, or something ).

Share this post


Link to post
Share on other sites
Quote:
Original post by python_regious
How to do it depends on your development environment and how you are compiling and linking your files.

If you're using Visual Studio, it's as simple as just adding another source file to your project. If you're using something like gcc - just add the other source file to the arguments string (so, gcc source1.cpp source2.cpp -o executable, or something ).


Well, it's not quite that simple actually. Were the OP to do only that, he'd soon have compiler errors and odd bugs galore. That's why the organizing files link Konfusius posted is invaluable -- it tells you what you need to do inside your headers and sources to make sure everything works together the way it should.

-Twilight Dragon

Share this post


Link to post
Share on other sites
Quote:
Original post by TDragon
Quote:
Original post by python_regious
How to do it depends on your development environment and how you are compiling and linking your files.

If you're using Visual Studio, it's as simple as just adding another source file to your project. If you're using something like gcc - just add the other source file to the arguments string (so, gcc source1.cpp source2.cpp -o executable, or something ).


Well, it's not quite that simple actually. Were the OP to do only that, he'd soon have compiler errors and odd bugs galore. That's why the organizing files link Konfusius posted is invaluable -- it tells you what you need to do inside your headers and sources to make sure everything works together the way it should.

-Twilight Dragon


Oh, yeah. I just assumed he all ready knew that.

Share this post


Link to post
Share on other sites

This topic is 4480 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this