www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/02/21/13:02:53

From: fjh AT cs DOT mu DOT OZ DOT AU (Fergus Henderson)
Subject: Re: g++ option -nostartfiles doesn't work.
21 Feb 1997 13:02:53 -0800 :
Approved: cygnus DOT gnu-win32 AT cygnus DOT com
Distribution: cygnus
Message-ID: <199702212003.HAA04011.cygnus.gnu-win32@murlibobo.cs.mu.OZ.AU>
Original-To: Nick AT fys DOT ruu DOT nl (Nick van Eijndhoven)
Original-Cc: gnu-win32 AT cygnus DOT com (gnu-win32)
In-Reply-To: <199702211613.RAA08607@ruunf0.fys.ruu.nl> from "Nick van Eijndhoven" at Feb 21, 97 05:13:34 pm
X-Mailer: ELM [version 2.4 PL24]
Original-Sender: owner-gnu-win32 AT cygnus DOT com

Nick van Eijndhoven, you wrote:
> 
> Dear GNU developers,
> I want to use g++ to perform the ld step of my *.o files to create
> a DLL. The original source files were C++ programs.
> Obviously in this effort I want to prevent the linking in of crt0.o
> and as such I specify
> 
> g++ -nostartfiles -o q.dll *.o
> 
> However, it seems that crt0.o is still linked in since I get an unresolved
> reference to main() from libmain.a.
> Do I understand something wrong here, or is the option -nostartfiles
> not working ?

What's the output of `g++ -v -nostartfiles -o q.dll *.o'?

> I also tried 
> 
> ld -o q.dll *.o -L'the proper directory' -lg++
> 
> but in this case the standard I/O facilities 'cout' and co. were not found.

You probably need to add `-lc -lcygwin -lkernel32 -lc'
at the end of your ld command.

Actually I forget the right order;
it might be `-lcygwin -lkernel32 -lc -lcygwin'.
Check what g++ does with `-v', and do the same (minus crt0).

-- 
Fergus Henderson <fjh AT cs DOT mu DOT oz DOT au>   |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>   |  of excellence is a lethal habit"
PGP: finger fjh AT 128 DOT 250 DOT 37 DOT 3         |     -- the last words of T. S. Garp.
-
For help on using this list, send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


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