| | |
Creating Makefile or Project File?
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Apr 2009
Posts: 3
Reputation:
Solved Threads: 0
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!
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!
•
•
Join Date: Feb 2008
Posts: 630
Reputation:
Solved Threads: 46
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
Dave
>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:
A makefile just makes that easier such that the command is:
Not much win there, so for simple projects the extra complications of makefiles are unnecessary.
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++ Syntax (Toggle Plain Text)
C:\> bcc32 Driver.cpp Definitions.cpp
C++ Syntax (Toggle Plain Text)
C:\> make my_makefile
I'm here to prove you wrong.
![]() |
Similar Threads
- creating fixed length file (C)
- How to create a project file in xml? (Legacy and Other Languages)
- What is the purpose of each visual basic project file type? (Visual Basic 4 / 5 / 6)
- Creating a memory mapped file (C++)
- Creating a Login Text file (VB.NET)
- creating the XML data file from Word (RSS, Web Services and SOAP)
- makefile c++ (C++)
- Unable to open Web Project '...'. The file path '...' does not correspond to the URL (ASP.NET)
- Unable to open Web Project '...'. The file path '...' does not correspond to the URL (Community Introductions)
- Creating a setup project using Setup Project Wizard (C#)
Other Threads in the C++ Forum
- Previous Thread: istream to ostream?
- Next Thread: deleting the repeated numbers
| Thread Tools | Search this Thread |
api array arrays based binary c++ c/c++ calculator char char* class classes code coding compile console conversion convert count database delete deploy desktop developer directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp iamthwee ifstream input int java lib linkedlist linker linux list loop looping loops map math matrix memory multiple news number numbertoword output pointer problem program programming project python random read recursion recursive reference return rpg sorting string strings temperature template templates test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock wordfrequency wxwidgets






