This is the mail archive of the
cygwin@sourceware.cygnus.com
mailing list for the Cygwin project.
Re: B20: undefined reference to cygwin32_conv_to_path
- To: Craig_Osterhout <cro@netzero.net>
- Subject: Re: B20: undefined reference to cygwin32_conv_to_path
- From: Mumit Khan <khan@xraylith.wisc.edu>
- Date: Mon, 10 May 1999 17:01:21 -0500 (CDT)
- cc: cygwin@sourceware.cygnus.com
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.
Regards,
Mumit
--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com