C++ SDK - Installation
About the barKoder SDK for C++ #
This guide covers Linux. For Windows (Visual Studio 2022), see Windows C++ SDK - Installation.
Architecture #
Key Features #
Building a sample app #
1. Make sure system libraries are installed: #
Debian/Ubuntu
sudo apt update
sudo apt install libcurl4-openssl-dev libjpeg-dev libpng-dev
CentOS / RHEL / AlmaLinux / Rocky Linux
sudo yum install libcurl-devel libjpeg-turbo-devel libpng-devel
sudo yum install libiconv
# (If not in repos, download from https://ftp.gnu.org/pub/gnu/libiconv/ and compile)
Fedora
sudo dnf install libcurl-devel libjpeg-turbo-devel libpng-devel
2. Copy desired architecture shared library file #
The files are placed in the libs folder. You should copy the (.so) files to the system library folder, or into project folder with adjusting LD_LIBRARY_PATH (and LIBRARY_PATH if needed).
3. Place a valid trial or production key in Config::InitializeWithLicenseKey function #
using namespace NSBarkoder;
ConfigResponse response = Config::InitializeWithLicenseKey("Put valid license key here");
4. Adjust decoder configuration settings #
Config *config = response.GetConfig();
Barcode Types & Decode Speed:
// Set decode speed
config->decodingSpeed = NSBarkoder::DecodingSpeed::Rigorous; // Most robust but slower
// Options: Fast, Normal, Slow, Rigorous
// Enable specific decoders
config->SetEnabledDecoders(std::vector<DecoderType>{
DecoderType::Datamatrix,
DecoderType::PDF417,
DecoderType::QR,
DecoderType::Code128,
DecoderType::UpcA,
DecoderType::Ean13
// ... add others as needed
});
// Other configuration examples from sample
config->maximumResultsCount = 100;
config->upcEanDeblur = 1; // Enhanced UPC/EAN decoding
config->code11.checksumType = Code11Config::ChecksumType::Single;
5. Run build script buildSample.sh 5.1 #
Optionally, app can be built without jpg and png libraries, in which case you need to remove them from the build script, and also to remove their definitions from the beginning of Sample.cpp, but in that case only BMP image types can be read.
6. Run the application with specifying image file name as first (and only) argument #
Building with OCR (MRZ) support (in addition to previous steps):
- use libs_ocr source path for libraries with OCR (MRZ) support (only 64 bit platforms are supported)
- copy files from OCR_Resources to executable folder
- make sure to use key with MRZ enabled, otherwise decoder won't return even masked result