-1

I have downloaded "Chilkat C/C++ Library Downloads for Qt, CodeBlocks, MinGW, TDM-GCC, and MinGW-w64" version of Chilkat library in order to run above ftp c++ code.

#include <stdio.h>
#include "include/CkZip.h"
#include "include/CkFtp2.h"
#include "include/CkMailMan.h"
#include "include/CkXml.h"
#include "include/CkPrivateKey.h"
#include "include/CkRsa.h"
#include "include/CkHttp.h"
#include "include/CkMime.h"
#include "include/CkMht.h"
#include "include/CkSsh.h"
#include "include/CkSFtp.h"
void DoNothing(void)
{
// Instantiate the objects...
CkZip zip;
CkMailMan mailman;
CkFtp2 ftp2;
CkXml xml;
CkPrivateKey privKey;
CkRsa rsa;
CkHttp http;
CkMime mime;
CkMht mht;
CkSsh ssh;
CkSFtp sftp;

printf("Zip version: %s\n",zip.version());
}
int main(int argc, const char* argv[])
{
DoNothing();
return 0;
}

I have read the README fille and tried to run sample C++ sample linkSample.cpp. for that reason I have read the linkSample.sh file which places in the Chilkat for Mingw folder. I have worked in windows and loaded mingw and the path of g++ added to the cmd. When I directly run the .sh folder command to the cmd I have received following error!

C:\Users\emma\Desktop\chilkat-9.5.0-x86_64-8.1.0-posix-seh-rt_v6-rev0>g++ -Wl,--enable-auto-import linkSample.cpp -o"linkSample.exe" -L. -lchilkat-9.5.0 -L/c/MinGW/lib -lcrypt32 -lws2_32 -ldnsapi

C:\Users\emma\AppData\Local\Temp\cciL4ofa.o:linkSample.cpp:(.text+0x10): undefined reference to `CkZip::CkZip()'
C:\Users\emma\AppData\Local\Temp\cciL4ofa.o:linkSample.cpp:(.text+0x1d): undefined reference to `CkMailMan::CkMailMan()'
C:\Users\emma\AppData\Local\Temp\cciL4ofa.o:linkSample.cpp:(.text+0x2a): undefined reference to `CkFtp2::CkFtp2()'

Could you guide me about compileing and running sample chilkat cpp program?

Thanks

Some programmer dude
  • 400,186
  • 35
  • 402
  • 621
emmanetw
  • 1
  • 1
  • https://stackoverflow.com/questions/2624238/c-undefined-references-with-static-library Please try the solutions mentiond in the thread above – ThivinAnandh Jul 07 '21 at 13:02
  • I have tried followings but it could not:! >>>g++ -o link.exe -Wl,--enable-auto-import linkSample.cpp -L. -lchilkat-9.5.0 -L/c/MinGW/lib -lcrypt32 -lws2_32 -ldnsapi >>>g++ -o link.exe linkSample.cpp -L. -lchilkat-9.5.0 -L/c/MinGW/lib -lcrypt32 -lws2_32 -ldnsapi >>>g++ -o link.exe linkSample.cpp -L. -lchilkat-9.5.0 – emmanetw Jul 07 '21 at 13:19

1 Answers1

0

I have change the workspace to linux and Also downloaded Chilkat "C/C++ Libraries for Linux" and copy the linkSample.cpp code to inside of it and run the following code:

g++ linkSample.cpp -Llib -lchilkat-9.5.0 -o linkSample -ldl

and the bin file have been appeared without error message. BUt, when I have tried to run executable bin file the following error message appears:

./linkSample: error while loading shared libraries: libchilkat-9.5.0.so: cannot open shared object file: No such file or directory

I want to keep my workspace in windows but I have just tried to see what happend in linux, and finally it does not work properly.

Any suggestion do you have?

Thanks

emmanetw
  • 1
  • 1