Hi everyone.
i have a problem that's killing me here. (as everybody else...)
this is friggin rediculouse though and i really need to understand what's up.

i have a project due tomorow, and i got basically nopthing to turn in because it does not actually run...

the problem is i believe that the namespaces are not named right in the header file or somehtign!

well here is a file list...

this is the MAIN.cpp file

// CS540_Lab3.cpp : Defines the entry point for the console application.

#include <iostream>
#include <fstream>
#include "CMPLX.h"
using namespace std;
ofstream echo("C:\\program output.txt");


int main()
{
//	ostream os;
	//this script will run the functions one after the other as they are desinged:
	double x, y;
	//let's create the class, with 0 values:
	Cmplx A;
	//we create another class with some numbers:
	Cmplx B(9.9, 8.8);
	//we create yet another class, for later use:
	Cmplx C;
	//welcome message:
	cout << "Welcome! the complex classes A, B and C have been initialized." << endl<< endl;
	echo << "Welcome! the complex classes A, B and C have been initialized." << endl<< endl;
	//we print the contents of A and B:
	echo << "The complex value of class A is: "; A.print(echo);echo << endl;
	cout << "The complex value of class A is: "; A.print(cout);cout << endl;
	echo << "The complex value of class B is: "; B.print(echo);echo << endl;
	cout << "The complex value of class B is: "; B.print(cout);cout << endl;
	echo << "The complex value of class C is: "; C.print(echo);echo << endl << endl;
	cout << "The complex value of class C is: "; C.print(cout);cout << endl << endl;
	//we input User Defined data to the class (A instance):
	cout << "Please input the values for class A (value <space> value) :";
	echo << "Please input the values for class A (value <space> value) :";
	cin >> x >> y;
    echo << x << " " << y << endl;
	cin.ignore();
	A.input(x,y);

	cout << "Here are the separate values:" << endl;
	echo << "Here are the separate values:" << endl;
	//we call the accessor functions to get the data aout of the 2 classes;
	cout << "X1 in class A:" << A.getX1() << endl;
	echo << "X1 in class A:" << A.getX1() << endl;
	cout << "X2 in class A:" << A.getX2() << endl;
	echo << "X2 in class A:" << A.getX2() << endl;
	cout << "X1 in class B:" << B.getX1() << endl;
	echo << "X1 in class B:" << B.getX1() << endl;
	cout << "X2 in class B:" << B.getX2() << endl;
	echo << "X2 in class B:" << B.getX2() << endl;
	echo << endl;
	cout << endl;
	//we call the Add function to add class A to class B (and output result)
	C = A.Add(B);
	cout << "The sum of A ("; A.print(cout); cout << ") and B ("; B.print(cout);cout << ") is: C (";C.print(cout);cout << ")" << endl;
	echo << "The sum of A ("; A.print(echo); echo << ") and B ("; B.print(echo);echo << ") is: C (";C.print(echo);echo << ")" << endl;

	cout << endl << "The application executed Succesfully! Hit enter to quit.";
	echo << endl << "The application executed Succesfully! Hit enter to quit.";
	//end the applicaiton on <return>
	cin.ignore();
}

this is my CMPLX.h header... missing some stuff, but putting it there does not change the result!?

class Cmplx {
       //
       private:
        //
        double X1;
		double X2;
        //
       public:
         Cmplx(double X1=0,double X2=0); // Default constructor... if i's not specified it's set to 0
		 void print(ostream &os);
		 void input(double X1,double X2);
		 double getX1();
		 double getX2();
		 Cmplx Add(const Cmplx& b);
		 ~Cmplx(); // destructor
	};

this is CMPLX.cpp.

#include "CMPLX.h"

Cmplx::Cmplx(double X1,double X2) {
       this->X1 = X1;
       this->X2 = X2;
      }

void Cmplx::print(ostream &os){
	os << Cmplx::X1 << "+" << Cmplx::X2 << "i";
}

void Cmplx::input(double X1,double X2){
		this->X1 = X1;
        this->X2 = X2;
}

double Cmplx::getX1(){
	return Cmplx::X1;
}
double Cmplx::getX2() {
	return Cmplx::X2;
}

Cmplx Cmplx::Add(const Cmplx& b) {
	//Cmplx::X1 + &b.X1, Cmplx::X2 + &b.X2;
	Cmplx tmp;
	tmp.X1 = this->X1 + b.X1;
	tmp.X2 = this->X2 + b.X2;
	return tmp; 
}

Cmplx::~Cmplx()
{
  // cout << "Object has been destroyed" << endl;
}

these are the error mesages...

------ Build started: Project: CS540_Lab3, Configuration: Debug Win32 ------
Compiling...
CMPLX.cpp
c:\documents and settings\andrea\my documents\visual studio 2008\projects\cs540_lab3\cs540_lab3\cmplx.h(11) : error C2061: syntax error : identifier 'ostream'
c:\documents and settings\andrea\my documents\visual studio 2008\projects\cs540_lab3\cs540_lab3\cmplx.cpp(8) : error C2065: 'ostream' : undeclared identifier
c:\documents and settings\andrea\my documents\visual studio 2008\projects\cs540_lab3\cs540_lab3\cmplx.cpp(8) : error C2065: 'os' : undeclared identifier
c:\documents and settings\andrea\my documents\visual studio 2008\projects\cs540_lab3\cs540_lab3\cmplx.cpp(8) : error C2448: 'Cmplx::print' : function-style initializer appears to be a function definition
CS540_Lab3.cpp
c:\documents and settings\andrea\my documents\visual studio 2008\projects\cs540_lab3\cs540_lab3\cmplx.h(11) : error C2061: syntax error : identifier 'ostream'
c:\documents and settings\andrea\my documents\visual studio 2008\projects\cs540_lab3\cs540_lab3\cs540_lab3.cpp(25) : error C2660: 'Cmplx::print' : function does not take 1 arguments
c:\documents and settings\andrea\my documents\visual studio 2008\projects\cs540_lab3\cs540_lab3\cs540_lab3.cpp(26) : error C2660: 'Cmplx::print' : function does not take 1 arguments
c:\documents and settings\andrea\my documents\visual studio 2008\projects\cs540_lab3\cs540_lab3\cs540_lab3.cpp(27) : error C2660: 'Cmplx::print' : function does not take 1 arguments
c:\documents and settings\andrea\my documents\visual studio 2008\projects\cs540_lab3\cs540_lab3\cs540_lab3.cpp(28) : error C2660: 'Cmplx::print' : function does not take 1 arguments
c:\documents and settings\andrea\my documents\visual studio 2008\projects\cs540_lab3\cs540_lab3\cs540_lab3.cpp(29) : error C2660: 'Cmplx::print' : function does not take 1 arguments
c:\documents and settings\andrea\my documents\visual studio 2008\projects\cs540_lab3\cs540_lab3\cs540_lab3.cpp(30) : error C2660: 'Cmplx::print' : function does not take 1 arguments
c:\documents and settings\andrea\my documents\visual studio 2008\projects\cs540_lab3\cs540_lab3\cs540_lab3.cpp(54) : error C2660: 'Cmplx::print' : function does not take 1 arguments
c:\documents and settings\andrea\my documents\visual studio 2008\projects\cs540_lab3\cs540_lab3\cs540_lab3.cpp(54) : error C2660: 'Cmplx::print' : function does not take 1 arguments
c:\documents and settings\andrea\my documents\visual studio 2008\projects\cs540_lab3\cs540_lab3\cs540_lab3.cpp(54) : error C2660: 'Cmplx::print' : function does not take 1 arguments
c:\documents and settings\andrea\my documents\visual studio 2008\projects\cs540_lab3\cs540_lab3\cs540_lab3.cpp(55) : error C2660: 'Cmplx::print' : function does not take 1 arguments
c:\documents and settings\andrea\my documents\visual studio 2008\projects\cs540_lab3\cs540_lab3\cs540_lab3.cpp(55) : error C2660: 'Cmplx::print' : function does not take 1 arguments
c:\documents and settings\andrea\my documents\visual studio 2008\projects\cs540_lab3\cs540_lab3\cs540_lab3.cpp(55) : error C2660: 'Cmplx::print' : function does not take 1 arguments
Generating Code...
Build log was saved at "file://c:\Documents and Settings\Andrea\My Documents\Visual Studio 2008\Projects\CS540_Lab3\CS540_Lab3\Debug\BuildLog.htm"
CS540_Lab3 - 17 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

So... am i missing something? do i need to include something somewhere?
i tried including EVERYTHING in the class file and the header file as well...
still the same message.
can anyone help?

needless to say i'm using visual studio 2008.
and the applciation works perfectly all on one file mailn.cpp...

You need to #include <iostream> in the files where you use "ostream"

niek_e got there first ...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.