delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/07/21/10:59:39

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-Id: <5.1.0.14.2.20020721075253.02c77d90@pop3.cris.com>
X-Sender: rrschulz AT pop3 DOT cris DOT com
Date: Sun, 21 Jul 2002 08:00:48 -0700
To: "Gerrit P. Haase" <gp AT familiehaase DOT de>, cygwin AT cygwin DOT com
From: Randall R Schulz <rrschulz AT cris DOT com>
Subject: Re: g++ (v.3.1.1-4) -mno-cygwin with a hello world sample
crashes oddly
In-Reply-To: <1821196999.20020721141056@familiehaase.de>
References: <ahe41c$ar4$1 AT main DOT gmane DOT org>
<ahb2lc$9m8$1 AT main DOT gmane DOT org>
<1465209200 DOT 20020721094429 AT familiehaase DOT de>
<ahe41c$ar4$1 AT main DOT gmane DOT org>
Mime-Version: 1.0
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id g6LExd927065

Gerrit,

If you remove the ".exe" extension from a binary executable, it gets 
treated like a script. Very few binaries are valid script files...

When you use the "-c" option, you suppress the whole linking phase. The 
output, regardless of its extension, is not a binary executable, it's an 
object file. If you run the "file" command on your "hiho.exe" or its 
earlier name: "hiho," you'll see something like this:

% g++ -c hiho.cpp
% file hiho.o
hiho.o: 80386 COFF executable not stripped - version 30821


Contrast:

% g++ hiho.cpp -o hiho.exe
% file hiho.exe
hiho.exe: MS Windows PE Intel 80386 console executable not relocatable


Lastly:

% g++ -mno-cygwin hiho.cpp -o hiho.exe
hiho.cpp:2: iostream: No such file or directory


Randall Schulz
Mountain View, CA USA


At 05:10 2002-07-21, you wrote:
>Hallo Dylan,
>
>Am Sonntag, 21. Juli 2002 um 12:58 schriebst du:
>
> > sounds like hiho is a script file or something there mate..  backquotes
> > shouldn't exist in C++ programs.. and there aren't any in the program I
> > included.
>
>It is the snippet you posted, not more and not less... just called it
>hiho because we saw that 'test' may be a bad name.  But it is really
>interesting what happens if you use an executable and its name is
>'hiho' without the postfix .exe:
>
>$ g++ -mno-cygwin -c hiho.cpp -o hiho
>
>$ chmod a+x hiho
>
>$ ./hiho
>./hiho: 9: Syntax error: EOF in backquote substitution
>
>$ mv hiho hiho.exe
>
>$ ./hiho
>bash: ./hiho: No such file or directory
>
>$ ./hiho.exe
>bash: ./hiho.exe: No such file or directory
>
>$ ls -l hi*
>-rwxrwxrwx    1 Administ Domänen-      222 Jul 21 14:05 hiho.cpp*
>-rwxrwxrwx    1 gerrit   Domänen-     1855 Jul 21 14:05 hiho.exe*
>
>$ cat hiho.cpp
>#include <iostream>
>int main (int argc, char *argv[])
>{
>  int frog = 10;
>  int blob = 20;
>  for ( int i = 0; i < 10; i++ )
>  {
>   std::cout << "hello world" << frog << " " << blob << std::endl;
>   frog += blob;
>  }
>  return(0);
>}
>
>
>I guess this result isn't much better;)
>
>
>Gerrit


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


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