Archived Forum Post

Index of archived forum posts

Question:

Visual C++ 6.0 link errors using the Chilkat "C" API

Apr 29 '13 at 09:12

I was trying to compile as sample - "sftp local file upload" Win32 application using visual studio 6 and the downloaded libraries . But every time i am getting following linking error

Linking...
SFTPUpload.obj : error LNK2001: unresolved external symbol "void cdecl CkSFtp_Dispose(void *)" (?CkSFtp_Dispose@@YAXPAX@Z)
SFTPUpload.obj : error LNK2001: unresolved external symbol "int cdecl CkSFtp_CloseHandle(void ,char const )" (?CkSFtp_CloseHandle@@YAHPAXPBD@Z)
SFTPUpload.obj : error LNK2001: unresolved external symbol "int cdecl CkSFtp_UploadFile(void ,char const ,char const *)" (?CkSFtp_UploadFile@@YAHPAXPBD1@Z)
SFTPUpload.obj : error LNK2001: unresolved external symbol "char const * cdecl CkSFtp_openFile(void ,char const ,char const ,char const )" (?CkSFtp_openFile@@YAPBDPAXPBD11@Z)
SFTPUpload.obj : error LNK2001: unresolved external symbol "int cdecl CkSFtp_InitializeSftp(void *)" (?CkSFtp_InitializeSftp@@YAHPAX@Z)
SFTPUpload.obj : error LNK2001: unresolved external symbol "int cdecl CkSFtp_AuthenticatePw(void ,char const ,char const )" (?CkSFtp_AuthenticatePw@@YAHPAXPBD1@Z)
SFTPUpload.obj : error LNK2001: unresolved external symbol "int cdecl CkSFtp_Connect(void ,char const ,int)" (?CkSFtp_Connect@@YAHPAXPBDH@Z)
SFTPUpload.obj : error LNK2001: unresolved external symbol "void cdecl CkSFtp_putIdleTimeoutMs(void ,int)" (?CkSFtp_putIdleTimeoutMs@@YAXPAXH@Z)
SFTPUpload.obj : error LNK2001: unresolved external symbol "void cdecl CkSFtp_putConnectTimeoutMs(void *,int)" (?CkSFtp_putConnectTimeoutMs@@YAXPAXH@Z)
SFTPUpload.obj : error LNK2001: unresolved external symbol "char const * cdecl CkSFtp_lastErrorText(void *)" (?CkSFtp_lastErrorText@@YAPBDPAX@Z)
SFTPUpload.obj : error LNK2001: unresolved external symbol "int cdecl CkSFtp_UnlockComponent(void ,char const )" (?CkSFtp_UnlockComponent@@YAHPAXPBD@Z)
SFTPUpload.obj : error LNK2001: unresolved external symbol "void * cdecl CkSFtp_Create(void)" (?CkSFtp_Create@@YAPAXXZ)
Debug/SFTPUpload.exe : fatal error LNK1120: 12 unresolved externals
Error executing link.exe.
I have tried linking all possible libraries and also tried with every library available . Still not liking ..

Please suggest on this


Answer

If your source filename ends in ".cpp", then it is being compiled as C++. If using the "C" API, then make sure to include the Chilkat "C" headers within an "extern "C"". For example:

extern "C" {

#include "C_CkSFtp.h"

}
If you are truly writing "C" code, then it might make more sense that your source file uses the ".c" extension. Also, if you are actually writing C++ code, then it might make sense to use the Chilkat C++ API instead of the "C" API.