Cygwin newbie, first try

Mumit Khan khan@xraylith.wisc.EDU
Mon May 31 21:10:00 GMT 1999

"Schaible, Joerg" <> writes:
> Hello,
> our development environment contains several applications and DLL's build
> with several compilers under Windows and OS/2. I wanna port this environment
> for a version with cygwin / mingw32 i.e. I don't wanna use the cygwin.dll,
> but the crtdll.dll or msvcrt.dll. To build the system we use a huge number
> of makefiles with individual settings for each compiler package. For
> compilation I use c++ for C++ files and gcc for C files. For linkage I use
> ld. I've installed the cygwin package and the mingw32 available from Mumit
> Khan's home page.
> Currently I try to build one of our little command line tools.
> All the C++ files were compiled using the following options:
> c++ -D_CONSOLE -c -fno-for-scope -frepo -mpentium -D_GwOS_WIN -D_GwGUI_WIN
> -DWIN32 -D_WIN32 -D__WIN32__ -W -Wreturn-type -Wunused -Wwrite-strings
> -Wconversion -Wmissing-prototypes -Woverloaded-virtual -DWINNT -DSTANDALONE
> -I../../core/win -I../../dde -I../../media -I../../meta -I../../base
> -I../../core -I../../device -I../../gm -I../../help -I../../40ctl
> -I../../cua -I../../chart -I../../dynobj -I../../license -I../../inter
> -I../../comm -I../../gwproc -I../../textedit
> -I//c/egcs-1-1-2/i386-mingw32/include -x c++ -DNDEBUG
> -o../../egcs112/rel/depend/st/main.o  main.cxx
> The ld was invoked by the following line:
> ld -Lc:/egcs-1-1-2/i386-mingw32/lib\\  -S
> ..\\..\\egcs112\\rel\\depend\\st\\cppsetup.o
> ..\\..\\egcs112\\rel\\depend\\st\\ifparser.o
> ..\\..\\egcs112\\rel\\depend\\st\\include.o
> ..\\..\\egcs112\\rel\\depend\\st\\main.o
> ..\\..\\egcs112\\rel\\depend\\st\\parse.o
> ..\\..\\egcs112\\rel\\depend\\st\\pr.o -o ..\\..\\egcs112\\bin\\depend.exe
> -Map ..\\..\\egcs112\\bin\\ -lmingw32 -lcrtdll -lmoldname
> But I have unresolved externals:
> ld: warning: cannot find entry symbol _mainCRTStartup; defaulting to
> 00401000
> ..\..\egcs112\rel\depend\st\include.o(.text+0x53d) undefined
> reference to `_alloca'
> ..\..\egcs112\rel\depend\st\main.o(.text+0x1352) undefined
> reference to `__builtin_vec_new'
> ..\..\egcs112\rel\depend\st\main.o(.text+0x1a81) undefined
> reference to `__builtin_vec_delete'

I suggest you either:

1. use gcc/c++ to link, which is always the preferred way, or
2. use gcc/c++ to link with -v option and see what libraries and startup
   files need to be linked in and *then* use ld.

You need -lgcc to get rid of some of the undefined symbols, and perhaps
all of the above.

You're also missing the startup files (crt*.o) and so on. Using "ld" 
without knowing more about the platform specific startups/libraries 
needed is a *very* bad idea.

> Interesting that my source is not using alloca anywhere (checked with the
> preprocessor output) and the missing operator new[] and delete[] seem to
> identify some basic configuration problem. Any idea how to the ld where to
> find the missing symbols?

"alloca" is used by gcc support code, and that's why you need -lgcc.


Want to unsubscribe from this list?
Send a message to

More information about the Cygwin mailing list