[Dev-C++] Compiling Separately: Separating Code into Modules ...
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: JB M. <jb...@so...> - 2003-06-06 03:08:21
|
Hello,
I am trying to compile a modular program. Is there an order to this =
(i.e. if I'm using Borland C++ Compiler at the DOS command prompt I'd =
have to compile each file separately, but with Dev C++ 4 (an IDE) I'm =
not sure.
When I try to compile the files separately, I get zero errors but =
zero bytes compiled ... what could be wrong?
I anybody can explain the procedure to me, I would appreciate it.
Below is the main() function "Main.cpp" which refers to the header and =
implementation files.
TIA
---
"C makes it easy to shoot yourself in the foot; C++ makes it harder, but =
when you do, it blows away your whole leg."=20
- Bjarne Stroustrup
--
J.B.
-------------------------------------------------------------------------=
--------
#include <iostream>
#include "PromptModule.h"
#include "ErrorHandlingModule.h"
using namespace std;
float GetDividend(void) // Returns dividend, a float
{
float Dividend =3D 0;
cout << "Dividend: ";
cin >> Dividend;
return Dividend; // Returns a copy of Dividend
}
float GetDivisor(void) // Returns the divisor
{
float Divisor =3D 1;
cout << "Divisor: ";
cin >> Divisor;
return Divisor;
}
float Divide
(const float theDividend, const float theDivisor) // Takes =
unmodifiable (const) arguments, returns float
{
return (theDividend/theDivisor); // Returns the result of the =
calculation
}
int main(int argc, char* argv[])
{
SAMSErrorHandling::Initialize();
float ReturnCode =3D 0;
try
{
float Dividend =3D GetDividend();
float Divisor =3D GetDivisor();
cout << Divide(Dividend, Divisor) << endl;
}
catch (...)
{
ReturnCode =3D
SAMSErrorHandling::HandleNotANumberError();
};
SAMSPrompt::PauseForUserAcknowledgement();
return ReturnCode;
}
|