Board index » cppbuilder » I have a question about my error message

I have a question about my error message


2003-10-24 02:09:35 AM
cppbuilder19
Hi everybody, I am a C++ student and wrote the following program for my second assignment in class and get an error message that says:
"Error: Unresolved external _main?referenced from c:\BC5\LIB\C0X32.OBJ"
Please help me undrestand this message.
Here is my program:
//Advanced C++, Assignment #2, 10-20-2003
#include <iostream>
#include <string>
#include "Complex.h"
#include <stdlib.h>
using namespace std;
float RealNumber;
float ImaginaryNumber;
float AR,AI,BR,BI,A;
//Default constructor
Complex::Complex()
{
SetRealValue(0.0);
SetImaginaryValue(0.0);
}
// Second constructor
Complex::Complex (float RealValue, float ImaginaryValue)
{
SetRealValue (RealValue);
SetImaginaryValue (ImaginaryValue);
}
//Get the RealValue
float Complex::GetRealValue()const
{
return RealValue;
}
//Get the ImaginaryValue
float Complex::GetImaginaryValue()const
{
return ImaginaryValue;
}
//Set the RealValue
void Complex::SetRealValue (float RealValue)
{
RealValue= RealNumber;
}
//Set the ImaginaryValue
void Complex::SetImaginaryValue (float ImaginaryValue)
{
ImaginaryValue = ImaginaryNumber;
}
//Adding Complex numbers
Complex Complex::Add ( const Complex &A) const
{
float AR = GetRealValue();
float AI = GetImaginaryValue();
float BR = A.GetRealValue();
float BI = A.GetImaginaryValue();
return Complex (AR+BR, AI+BI);
}
//Subtracting Complex numbers
Complex Complex::Sub ( const Complex &A) const
{
float AR = GetRealValue();
float AI = GetImaginaryValue();
float BR = A.GetRealValue();
float BI = A.GetImaginaryValue();
return Complex (AR-BR, AI-BI);
}
//multiplying Complex Numbers
Complex Complex::Multiply ( const Complex &A) const
{
float AR = GetRealValue();
float AI = GetImaginaryValue();
float BR = A.GetRealValue();
float BI = A.GetImaginaryValue();
return Complex ((AR*BR)-(AI*BI)),((AR*BR)+(AI*BI));
}
=====================================================
//Complex.h declaration of Complex ADT
#ifndef COMPLEX_H
#define COMPLEX_H
#include <iostream>
#include <string>
using namespace std;
class Complex
{
public:
//Member functions
//Default constructor
Complex();
// A second constructor
Complex (float RealValue=0.0, float ImaginaryValue=0.0);
// Addition
Complex Add (const Complex &c) const;
// Subtraction
Complex Sub (const Complex &c) const;
// Multiplication
Complex Multiply (const Complex &c) const;
// Stream Facilitators
void Insert (ostream &sout)const;
void Extract (istream &sin);
protected:
// Inspectors
float GetRealValue()const;
float GetImaginaryValue()const;
// Mutators
void SetRealValue (float RealValue);
void SetImaginaryValue (float ImaginaryValue);
private:
//Data members
float RealValue;
float ImaginaryValue;
};
// Complex ADT: auxiliary operator description
Complex operator+ (const Complex &A, const Complex &B);
Complex operator- (const Complex &A, const Complex &B);
Complex operator* (const Complex &A, const Complex &B);
ostream& operator << (ostream &sout, const Complex &A);
istream& operator>>(istream &sin, const Complex &A);
#endif
 
 

Re:I have a question about my error message

"Mojgan" < XXXX@XXXXX.COM >wrote:
Quote
[...] "Error: Unresolved external _main?
Where's your Main() ?
~ JD
 

Re:I have a question about my error message

On 23 Oct 2003 11:09:35 -0700, Mojgan wrote:
Quote
Hi everybody, I am a C++ student and wrote the following program for my second assignment in class and get an error message that says:

"Error: Unresolved external _main?referenced from c:\BC5\LIB\C0X32.OBJ"
don't you need
#include "complex.h"
int main()
{
Complex A(3.1,0);
Complex B(0,3);
Complex C = A + B;
//etc
return 0;
}
--
liz
 

{smallsort}