Linker: Bug or Feature?

Lassi A. Tuura lat@iki.fi
Fri Nov 6 09:01:00 GMT 1998


|> I get an "undefined reference to asmfunctionfoo...", the function in
|> the .asm / .o file.  [renaming .cpp to .c works]

The C file probably says `extern int asmfunctionfoo (...)'?  If the file
extension is `.cpp', GCC compiles the file as C++ and function names
will be mangled, e.g. `int asmfunctionfoo (void)' would become something
like `asmfunctionfoo__Fv'.  If it is compiled as C, the name is not
mangled and the link succeeds.  If you want to compile it as C++, use
`extern "C"' instead of `extern'. 

Hope this helps,
//lat
--
With sufficient thrust, pigs fly just fine.  However, this is not
necessarily a good idea.  It is hard to be sure where they are going
to land, and it could be dangerous sitting under them as they fly
overhead.  --RFC1925, "The Twelve Networking Truths"

-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".



More information about the Cygwin mailing list