delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/01/20/18:00:36

From: "Inyaki Rodríguez" <0115561c01 AT abonados DOT cplus DOT es>
Newsgroups: comp.os.msdos.djgpp
Subject: Newbie questions
Date: Tue, 20 Jan 1998 23:40:45 +0100
Organization: Unisource Espana NEWS SERVER
Lines: 39
Message-ID: <6a38tf$7vo$1@talia.mad.ibernet.es>
NNTP-Posting-Host: abonado-195-53-36-78.cat.es
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Hi, I'm a newbie with C++ and I want to work with class Complex but I have
some questions.
I had write this sample program:

#include <iostream.h>
#include <complex.h>
int main(void)
{
  Complex z1;
  Complex z2;
  z1=complex(1,1);
  z2=complex(1.5,3);
  cout << "z1+z2= " << z1+z2 << "\n";
  cout << "z1*z2= " << z1*z2 << "\n";
  cout << "z1/z2= " << z1/z2 << "\n";
  return 0;
}

When I try to compile it whit this command:
gcc -O2 -m486 ejemplo.cc -o ejemplo.exe

I get this error log:

ejemplo.cc: In function `int main()':
ejemplo.cc:6: `Complex' undeclared (first use this function)
ejemplo.cc:6: (Each undeclared identifier is reported only once
ejemplo.cc:6: for each function it appears in.)
ejemplo.cc:6: parse error before `;'
ejemplo.cc:8: `z1' undeclared (first use this function)
ejemplo.cc:8: warning: implicit declaration of function `int complex(...)'
ejemplo.cc:9: `z2' undeclared (first use this function)

How can I compile it?

Thanks,
Inyaki



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019