My code wont link with gcc but does with Visual Studio

This is a discussion on My code wont link with gcc but does with Visual Studio within the C Programming forums, part of the General Programming Boards category; I have a build issue that I can't seem to figure out. I'm building a command-line tool that is written ...

My code wont link with gcc but does with Visual Studio

I have a build issue that I can't seem to figure out. I'm building a command-line tool that is written in C with some portions in C++. My issue is however not related to C++.

The tool links statically to some other libraries such as a communication library and a custom Kerberos utility library that has been ported over from Windows. That has always worked. Recently the communication library on the Windows side has been updated to support encryption using the open source libraries tomcrypt (www.libtom.org) and tommath. They are wrapped using a small custom C++ library.

I am now primarily porting the code to Mac OS X (and later to Linux). g++ and gcc 4.2 vs 4.0 in Xcode doesn't make any difference, nor does building with 10.6, 10.5 or 10.4 as the target. I have also tried moving the "ltc_math_descriptor ltc_mp;" to another file but that didn't have an effect either.

I'm sort of stumped as to why I at all get the undefined symbol error. The C libraries contain the appropriate "extern "C" {}" wrappers.

I'd me immensely grateful if somebody could shed some light upon why I see the error from the linker.