Thursday 5 August 2010

Missing extern "C"

I'm sure most of us hit the problem of that annoying linker error "unresolved external symbol "aoein0hepqo2washpeofh a@foo" (ok, I just hammered the keyboard - it's no real live symbol name!).
After triple-checking the library link list it turns out that (again) the mixing of C and C++ modules and libraries is the root of the problem.

But what to do if you have a C++ module that references an API function declared in a header file that is not prepared to be included by C++ code?

If you are not allowed to patch the file (may be its 3rd party stuff) there is a quite simple solution:

extern "C"
{
#include
}

Cheers,
Jürgen

No comments: