Creating Makefile or Project File?

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Apr 2009
Posts: 3
Reputation: DonB is an unknown quantity at this point 
Solved Threads: 0
DonB DonB is offline Offline
Newbie Poster

Creating Makefile or Project File?

 
0
  #1
Jun 12th, 2009
I'm using Borland's TurboC++ 2006 Explorer.
I'm working on a class project, and have a program consisting of 3 files:

Header (.h)
Definitions (.cpp)
Driver (.cpp)


Definitions.cpp contains the typical #include Header.h
The program compiles and links correctly if Driver.cpp contains the statement #include Definitions.cpp
The instructor doesn't like using the #include Definitions.cpp in the Driver.cpp file, and suggests a 'project or makefile' instead.

Is there a way for the Borland IDE to generate something I can add to the file list I send to the instructor that will cause the 3 files to compile/link together properly for execution?

Any help will be greatly appreciated!
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 630
Reputation: daviddoria is a jewel in the rough daviddoria is a jewel in the rough daviddoria is a jewel in the rough 
Solved Threads: 46
daviddoria daviddoria is offline Offline
Practically a Master Poster

Re: Creating Makefile or Project File?

 
1
  #2
Jun 12th, 2009
Yea, I think that generally the convention is to not include .cpp files. Surely you can make a project with any IDE. CMake is becoming pretty popular - it is a "crossplatform project building" utility - that is, in linux, you can generate a makefile or a KDevelop project. In windows you can generate a visual studio project. It's much much easier than writing makefile yourself for large projects, but for this small of a project I'm sure you could find a makefile tutorial online (this one looks reasonable http://www.opussoftware.com/tutorial/TutMakefile.htm)

Dave
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 7,674
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: 727
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Code Goddess

Re: Creating Makefile or Project File?

 
2
  #3
Jun 12th, 2009
>I'm using Borland's TurboC++ 2006 Explorer.
Then you shouldn't need a makefile, unless you're turning in just the source for your project. IDEs handle that kind of grunt work for you.

>The instructor doesn't like using the #include Definitions.cpp in the Driver.cpp file
Wise of him. It's a bad habit to get into because it's a breeding ground for multiple definition errors. #include is a glorified copy/paste, and if you place duplicate definitions in multiple files and then link them together, the linker will complain.

>and suggests a 'project or makefile' instead.
As I said, since you're using an IDE, you should already have a project. The only concern then is whether or not your instructor is using an IDE that's compatible with yours. Alternatively, if all you have is two source files and a header, your instructor can easily rebuild your project in his IDE, or compile manually from the command line. It's as simple as this:
  1. C:\> bcc32 Driver.cpp Definitions.cpp
A makefile just makes that easier such that the command is:
  1. C:\> make my_makefile
Not much win there, so for simple projects the extra complications of makefiles are unnecessary.
I'm here to prove you wrong.
Reply With Quote Quick reply to this message  
Join Date: Apr 2009
Posts: 3
Reputation: DonB is an unknown quantity at this point 
Solved Threads: 0
DonB DonB is offline Offline
Newbie Poster

Re: Creating Makefile or Project File?

 
0
  #4
Jun 12th, 2009
Your answer is right on. I'm only turning in the source, and I've no idea what IDE(s) the instructor has available. Your command-line option is exactly what I was looking for, but just couldn't tweak out of the IDE's on-line documentation Thx.
Reply With Quote Quick reply to this message  
Reply

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


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC