C Library in C++ Program

Hello everybody

i have a Library with C Functions and Variables and try to use it in a
C++ Program.
The Linker give the error message ‘Warning(1028): char near * near
VarName is an undefined reference’

If i try to link a c Program without the library i get the error message
‘Warning(1028): _VarName is an undefined reference’

If i try to use _VarName in the C++ Program i get still the undefined
message.

What i have to do to use the C library in my C++ Program ?

Thanks Dieter

“Dieter Schemmelmann” <dieschemm@t-online.de> wrote in message
news:3D355678.4756DC02@t-online.de

Hello everybody

i have a Library with C Functions and Variables and try to use it in a
C++ Program.
The Linker give the error message ‘Warning(1028): char near * near
VarName is an undefined reference’

If i try to link a c Program without the library i get the error message
‘Warning(1028): _VarName is an undefined reference’

If i try to use _VarName in the C++ Program i get still the undefined
message.

What i have to do to use the C library in my C++ Program ?

You have to wrap the header of the C library with

#ifdef __cplusplus
extern “C” {
#endif




#ifdef __cplusplus
}
#endif

Look into system header file for examples.

Thanks Dieter