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!

7 Years
Discussion Span
Last Post by DonB

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)


Votes + Comments
Yes, that one looks reasonable :)

>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:

C:\> bcc32 Driver.cpp Definitions.cpp

A makefile just makes that easier such that the command is:

C:\> make my_makefile

Not much win there, so for simple projects the extra complications of makefiles are unnecessary.


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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.