Solved

STL complex class and iostream

Posted on 1999-01-19
5
879 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
  • 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
xyBalance chalenge 58 88
repeatSeparator  java  challenge 13 56
string initialization in java 11 103
Line meaning 9 77
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

746 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now