g++ option -nostartfiles doesn't work.

Fergus Henderson fjh@cs.mu.OZ.AU
Fri Feb 21 12:03:00 GMT 1997


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@cs.mu.oz.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@128.250.37.3         |     -- the last words of T. S. Garp.
-
For help on using this list, send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".



More information about the Cygwin mailing list