B20: undefined reference to cygwin32_conv_to_path

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

On Mon, 10 May 1999, Craig_Osterhout wrote:

> This simple program compiles fine when using the "C" compiler.
>  Works if it is named "tst.c" and gcc -o tst.exe tst.c.
> Will not work if it named tst.cpp.
> When I try to use the "C++" compiler I get "undefined reference
> cygwin32_conv.......". I tried linking to the cygwin library.

That's because C and C++ are two different languages that use different
linkage conventions. cygwin_conv_to_full_win32_path is exported as a
"C" function from Cygwin DLL and you need to prototype it such when using
it in C++ code. 

  extern "C" void 
  cygwin_conv_to_full_win32_path (const char *path, char *win32_path);

and you're all set. Also note that all the cygwin32_* functions have
been renamed cygwin_*, although b20.1 still supports the old names.

> g++ -o tst.exe tst.cpp -lcygwin

-lcygwin is not needed since gcc/c++/g77/etc all add that automatically.
Doesn't hurt however.


Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

More information about the Cygwin mailing list