Sign in to follow this  
bikola_p

multiple cpp files

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

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