In article <1993Jan22.053408.14225@gmuvax2.gmu.edu>, mbenson@gmuvax2.gmu.edu (Michael Benson) writes:
|> I need some help.
|>
|> I have a piece of code which I know compiles correctly into an object
|> file. The code is in the Microsoft C language. It has a header file
|> that properally defines the prototypes.
|>
|> I include the header file in a new program that is written in Borland
|> C++ (version 3.1). It compiles fine, but fails to link. It gives the
|> error "undefined symbol xxxxx in module xxx.cpp" I know that for some
|> reason the linker doesn't want to recognize the code in the c routine.
|> I have tried (maybe naively) to use extern "C" with the header file, but
|> that failed.
That should work. What one normally expects to see is something like:
extern "C"
{ int function ( args );
}
In the header file of the c++ using the c code. The c code is compiled seperately as c code and then linked as a c library. If it is kosher ansi c though it should compile as c++ code so you should not have a problem if you just compile it as c++ - the linker won't care then.