Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Unusual link errors in Borland C++

I am getting the following linker error:

[Linker Error] Error: Unresolved external 'CErrorHandler::iLoggingLevel' referenced from C:\PROJECTS\WS_B\SERVER\VERSION.EXE\OBJ\DM_LINGUSERVER.OBJ

The variable is a public static variable in CErrorHandler class.

I am doing all the right #include and the project file is set up to look in all the right directories.

What am I doing wrong?
[425 byte] By [Chris H Baker] at [2007-11-11 10:10:00]
# 1 Re: Unusual link errors in Borland C++
static data members must be defined in a separate .cpp file, in addition to being declared in a header file. When only the header file is compiled and the linker can't find that symbol in one of the compiled binaries, you get this kind of error.
Make sure that the static data member is defined somewhere in the project. Also ensure that the definition and the declaration match, i.e., the name, the type etc are the same in both of them.
Danny at 2007-11-11 20:59:25 >