Chilkat sample, linkSample.cpp program, could not be compiled - c++

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

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

Related

VICON DataStream SDK FAIL in LINUX

I downloaded DataStream SDK 1.11.0 from offical website. Then, I extracted for Linux64 part.
Then I ran my Ubuntu. My file struct is like that:
Linux64 (directory)
main.c
My main.c file is : #include "Linux64/DataStreamClient.h" #include <stdio.h>
Okay, When I gcc main.c file then I got there errors: IDataStreamClientBase.h vector: No such file or directory and memory: No such file or directory
I can't run just Client_GetVersion function such as simple program

How to use png++ (C++ library) on Windows?

I am trying to use this C++ library (png++) on Windows, but I unable to compile any program when I use it. Example of Code I am using to test:
#include <png++/png.hpp>
#include <png.h>
int main(){
//anything
}
When I try to compile using g++ -I path/png++ main.cpp -o main, I get
fatal error: png++/png.hpp: No such file or directory
#include <png++/png.hpp>
I understand png++ depends on libpng, I tried adding it as an I- flag, i.e. compile using
g++ -I path/png++ -I path/libpng main.cpp -o main, but it doesn't resolve the issue, png.h is found by the compiler but not png++/png.hpp.
I hope someone will be able to help.
Thanks!

how to compile code using external dll library

I want to compile program with one file test.cpp, which use external library (i have dll and lib). How to do that?
My test.cpp
#include <ExternalLib.h>
#include <iostream>
#include <stdio.h>
#define USE_USB_AUTO_CONNECT 1
int main()
{
printf ("Characters: %c %c \n", 'a', 65);
return 0;
}
ExternalLib is provided by third part company with files: ExternalLib.lib and ExternalLib.dll. There are also files with extension so and a.
When I compile with command:
g++ test.cpp
I get error:
test.cpp:1:20: fatal error: ExternalLib.h: No such file or directory
#include <ExternalLib.h>
Thanks for your help.
I think you are trying to use dll files (compiled in Windows) under Linux, that will not work.
Anyway your error is that the compiler isn't able to locate your header file, to solve this you have several options:
1) Provide the include path when compiling using -I switch
i.e.: g++ test.cpp -I<path to your include directory>
2) Copy the ExternalLib.h to the same directory in which test.cpp lies and use #include "ExternalLib.h" instead of #include <ExternalLib.h>
3) Provide relative path to ExternalLib.h starting from the directory in which test.cpp lies. That is, replace #include <ExternalLib.h> for #include "../../external/ExternalLib.h"
This will solve the No such file or directory problem. Then you will also have to provide the binary/library files using -L (for library path) and -l (for library file) switches.

undefined reference to `tesseract::TessBaseAPI::TessBaseAPI()'

I am trying to do something with the tesseract c++ library but I get the following linker error(mingw32-g++):
undefined reference to `tesseract::TessBaseAPI::TessBaseAPI()'
I am using Code::Blocks as my IDE and have done the following steps to prepare my environment:
Downloaded the sources and prepared my build folder as descripted at http://tesseract-ocr.googlecode.com/svn/trunk/vs2008/doc/setup.html
Created a new Code::Blocks project
Added all libraries included in the lib directory to the Project (Settings->Compiler Settings->Linker Setting->Link libraries->add)
Added the three additional folders (include, include/tesseract, include/leptonica) to the search directory list (Settings->Compiler Settings->Search directorys->add)
Then I have written some code to test my configuration ...
#include <baseapi.h>
#include <allheaders.h>
#include <iostream>
using namespace std;
int main()
{
tesseract::TessBaseAPI *api = new tesseract::TessBaseAPI();
return 0;
}
... and the above written linker error occurs.
I don´t know what I am doing wrong, hope that anybody have an idea.
Thanks a lot.
You have to add the libraries under the Other Linker Flags in Build Settings.
Try adding -ltesseract and -lstdc++ and the paths to tesseract and leptonica libraries in the following convention:
-L/usr/local/Cellar/tesseract/3.04.01_2/lib
I had to add all the C/C++ include paths:
..\tesseract_3.05\api
..\tesseract_3.05\ccmain
..\tesseract_3.05\ccutil
..\tesseract_3.05\ccstruct
..\tesseract_3.05\classify
..\tesseract_3.05\cube
..\tesseract_3.05\cutil
..\tesseract_3.05\dict
..\tesseract_3.05\neural_networks\runtime
..\tesseract_3.05\textord
..\tesseract_3.05\viewer
..\tesseract_3.05\opencl
..\tesseract_3.05\wordrec
..\leptonica\src
..\liblept
Also I added all the libraries:
giflib.lib
libjpeg.lib
liblept.lib
libpng.lib
libtesseract.lib
libtiff.lib
libwebp.lib
openjpeg.lib
zlib.lib
In ubuntu, installing tesseract and leptonica:
sudo apt install tesseract-ocr
sudo apt install libtesseract-dev
(see:https://github.com/tesseract-ocr/tesseract/wiki)
Place the headers:
#include <tesseract/baseapi.h>
#include <leptonica/allheaders.h>
Compile:
g++ program.cpp -o program -llept -ltesseract

C++ OpenGL, errors when linking, compiling

Witam,
nie potrafię sobie poradzić z błędami linkera chyba że kompilatora(i raczej to jest kompilator). Chciałem swoje stare projekty skompilować na nowo i poprawić programy, jednak nie potrafię przejść przez proces linkowania.
w folderze z source.cpp posiadam dodatkowo
Hello,
i cant move on with errors from linker, or compiler. I want to compile my old projects, but i cant cope with errors.
in folder with source.cpp i have also
open32.dll
glu32.dll
glut32.dll (i download it)
glut.h (si download it)
glut.lib (i download it)
glut.def (i think its not nessesery)
bach looks like
path %pathC:\MinGW\bin
g++ -o program.exe main.cpp glut32.lib
and i get errors in every line where i use function from glut32.dll/opengl.dll, all errors are similar
C:\Users\Przemko\AppData\Local\Temp\cc4n2CuY.o:main.cpp:(.text+0xe5): undefined reference to `glClearColor#16'
In MinGW\Include i have folder GL with headers:
glu.h
gl.h
glext.h
"i get it while installing MingW"
my source include
#include <time.h>
#include <iostream>
#include <math.h>
#include <windows.h>
#include "glut.h"
I need help, i dont remember how to link every item, i wish i have my old bash and libary, but i dont.
You don't link with the actual OpenGL library, you need to add -lGL to your command:
$ g++ -o program.exe main.cpp glut32.lib -lGL
You might want to keep your dll files in SysWOW64 folder instead of System32 folder in case you have x64 libraries.