Solved

STL complex class and iostream

Posted on 1999-01-19
5
887 Views
Last Modified: 2013-11-20
I am having conflicts compiling with the built in complex class and ostream definitions. The errors are all of the type:

: error C2371: 'ostream' : redefinition; different basic types

and
: error C2784: ...

Here is a sample of how the code is set up and results in the same type errors that I am getting ( under a Win32 console application in MS VC++ version 5.0:

#include <complex>
#include <iostream.h>
using namespace std;

void main( void )
{
   complex<double> temp(1.0, -1.0);
   cout << "Test " << temp.real() << '\t' << temp.imag()
        << endl;
}

Thanks for any assistance.
0
Comment
Question by:mclayton99
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 

Author Comment

by:mclayton99
ID: 1327931
Edited text of question
0
 

Expert Comment

by:koskia
ID: 1327932
hey
you should really show us how you write that.

with the little you wrote, when using a header file and not pointing the .h, you should include "using namespace std;" below:

#include <complex>
#include <iostream>
using namespace std;

or

#include <complex>
using namespace std;

#include <iostream.h>

but not what you wrote
0
 

Author Comment

by:mclayton99
ID: 1327933
Edited text of question
0
 

Author Comment

by:mclayton99
ID: 1327934
Edited text of question
0
 
LVL 23

Accepted Solution

by:
chensu earned 20 total points
ID: 1327935
It should be OK. Install the Service Pack 3 of Visual C++ 5.0.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question