Search code examples
c++functionbuild-error

C++ G711 encoder decoder error


I have the following code in C++ ( Visual Studio 2013 ) to declare a function prototype in a header file:

extern "C" __cdecl
short int
G_Init(
 void *Ptr,
 char Encoding);

and the compiler returns the following error:

error C2062: type 'short' unexpected

What I'm doing wrong ?


Solution

  • MSDN says: "Place the __cdecl modifier before a variable or a function name."

    That is, extern "C" short int __cdecl G_Init, not extern "C" __cdecl short int G_Init.