question

Please support our C advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Oct 2006
Posts: 8
Reputation: shadowmoon is an unknown quantity at this point 
Solved Threads: 0
shadowmoon shadowmoon is offline Offline
Newbie Poster

question

 
0
  #1
Dec 12th, 2006
how can i get a program to include other cpp files??

like if i was on a tem for school and we spilt the work into smaall parts ca we just use ome kind of include function to put all the files together withotu copy-pasting:????
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 7,827
Reputation: Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute 
Solved Threads: 750
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Senior Bitch

Re: question

 
0
  #2
Dec 12th, 2006
That's usually done by linking multiple object files together.
New members chased away this month: 3
Reply With Quote Quick reply to this message  
Join Date: May 2004
Posts: 178
Reputation: jim mcnamara is on a distinguished road 
Solved Threads: 10
jim mcnamara jim mcnamara is offline Offline
Junior Poster

Re: question

 
1
  #3
Dec 12th, 2006
What normally is done (assuming that only one of the code pieces has a main() ) is to compile each of the sourcefiles into a separate object file and then link them all into one program.

To simplify a compile you can create a makefile to do this, or create a project in IDE's like Visual Studio.

An example using g++
  1. g++ file1.cpp file2.cpp file3.cpp -o myprogram
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C Forum
Thread Tools Search this Thread



Tag cloud for C
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC