www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/08/24/21:51:54

From: "Anne Hawson" <anne DOT hawson AT virgin DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: I can't compile with the -O2 switch.
Date: Tue, 24 Aug 1999 20:32:14 +0100
Organization: Virgin Net Usenet Service
Lines: 52
Message-ID: <7purvn$j7h$1@nclient11-gui.server.virgin.net>
NNTP-Posting-Host: p21-grebe-gui.tch.virgin.net
X-Trace: nclient11-gui.server.virgin.net 935523127 19697 194.168.63.141 (24 Aug 1999 19:32:07 GMT)
X-Complaints-To: abuse AT virgin DOT net
NNTP-Posting-Date: 24 Aug 1999 19:32:07 GMT
X-Newsreader: Microsoft Outlook Express 4.72.3110.5
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

I wanted to compile C++ code into an executable with optimisations.
In this case, it is a tiny program called "keypress.cpp"
(pasted at the end of this message).
It compiles fine with -

>  gxx -o keypress.exe keypress.cpp
but complains with -

>  gxx -O2 keypress.exe keypress.cpp
This produces -

>  keypress.exe(.text+0x200):crtfgo32.c: multiple definition of `__exit'
>  c:/djgpp/lib/crt0.o(.text+0x1ec):crt0.s: first defined here
>  keypress.exe(.text+0x2e4):crtfgo32.c: multiple definition of `__sbrk'
>  c:/djgpp/lib/crt0.o(.text+0x2d0):crt0.s: first defined here
>  keypress.exe(.text+0x4c8):crtfgo32.c: multiple definition of
`_crt0_init_mcount'
>
>  c:/djgpp/lib/crt0.o(.text+0x4b4):crt0.s: first defined here
>  keypress.exe(.text+0x2fc):crtfgo32.c: multiple definition of `__brk'
>  c:/djgpp/lib/crt0.o(.text+0x2e8):crt0.s: first defined here
>  keypress.exe(.text+0x14):crtfgo32.c: multiple definition of `start'
>  c:/djgpp/lib/crt0.o(.text+0x0):crt0.s: first defined here
>  c:/djgpp/tmp\cccq2u4j(.text+0xc):keypress.cpp: multiple definition of
`main'
>  keypress.exe(.text+0x4d8):crtfgo32.c: first defined here

I have no idea what this means.
Can anyone see what is wrong and help me with this problem?
If you need other information, then I will be happy to supply it.

Thanks
Dan.

----------------------------

#include <conio.h>
#include <iostream.h>

int main(void)
{
  int c;
  c = getch();
  while (c != 27) //27 = esc
  {
    cout<<"pressed :"<<c<<'\n';
    c = getch();
  }
  return 0;
}


- Raw text -


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