Getting Started with IC Imaging Control 4 .NET Class Library
To help setting up projects, the installer sets two environment variables:
IC4PATH
points to the installation directoryPATH
is extended to includeIC4PATH%\bin
The IC Imaging Control 4 installer puts the include, library and binary files into
IC4PATH%\include
IC4PATH%\lib
IC4PATH%\bin
Setting Up the Project
To compile a C++ program using IC Imaging Control 4 C++ Class Library, include files and libraries have to be found by the project in some way. The specifics depend on the type of project being used.
Using Microsoft Visual Studio
After creating a C++ project, make the following changes to the project settings:
- Add
$(IC4PATH)\include
to the list of include directories - Add
$(IC4PATH)\lib
to the list of library directories
Using CMake
Add the following line to your CMakeLists.txt
to instuct CMake to look for the ic4 library package:
find_package(ic4 REQUIRED)
Then, add ic4::core
to the target_link_libraries
section for your executable. CMake will then automatically add the proper include pathes and library options to your project.
To copy the ic4 binary files to your output directory, use the ic4_copy_runtime_to_target
function.
The minimum CMakeLists.txt for a ic4 C++ project looks like this:
cmake_minimum_required(VERSION 3.8)
project( hello-ic4 )
find_package( ic4 REQUIRED )
add_executable( hello-ic4
hello-ic4.cpp
)
target_link_libraries( hello-ic4
PRIVATE
ic4::core
)
ic4_copy_runtime_to_target( hello-ic4 )
Hello IC4!
Add this code to your main C++ file to check whether project setup was successful:
#include <ic4/ic4.h>
#include <iostream>
int main()
{
ic4::initLibrary();
std::cout << "Hello, IC4!" << std::endl;
}