In VS2005, I was using _cdecl calling convention and the project builds without any linker errors. After I change the calling convention to _stdcall while porting the project to VS2008, I get the following error:
error LNK2001: unresolved external symbol __imp__GCBOpen@8.
Configuration Settings>C\C++>Genral>Common Language Runtime support is set to No Common Language Runtime support
I need help regarding any project settings or code changes that need to be done in order to resolve the issue. Any help is appreciated.
It looks like GCBOpen()
is compiled __cdecl
but its declaration does not explicitly state that. (That's why it linked OK when your default was __cdecl
but breaks when you change it.) In general it is good practice for declarations of functions in external libraries to specify the calling convention to avoid problems such as the one you have enountered.
Somewhere you must have something like:
__declspec(dllimport)
extern int GCBOpen(int, int);
which would be better off as:
#define CALLCONV __cdecl
__declspec(dllimport)
extern int CALLCONV GCBOpen(int, int);