Goal: use a 3rd party library in my c++ project, on Windows and Linux.
Example: the support library for a USB smart card reader.
I'm starting from previous project, that's already set up for both platforms.
I'm assuming here that the 3rd party provides a compiled lib and the necessary header files.
I'll be using shared libraries: .so in Linux, .dll for Windows.
I intended to write both Linux and WIndows instructions in the same post. But it was getting long.
So I write shared settings and Linux here. The Windows setup goes to 4b.
The libraries for my smart card reader (Digital Logic µFR Nano) are distributed as an archive that supports several platforms.
There's a single shared include, and binary files organised per target.
In this post, I'll use two dynamic options:
The test program is a simple routine that talks to the smart card device over USB. All communication goes through the vendor's API and lib.
Because the home location of the 3rd party distro is shared between all platforms and OSs, I will create a variable that's available for all Eclipse configurations.
That makes it easy later on to move to a newer version of the library by just changing that variable.
It also shows how to do a setting that impacts all configurations.
In the next steps, I'll define the library and include file locations relative to this variable.
This is a good point to learn how to configure a set of configurations in a single action.
I only want to define settings for the Linux toolchain. In stead of selecting All configurations, I'll check Multiple configurations.
Then I select the two Linux configs. I want to configure both the include and library settings.
First the include:
Although the include location is the same for all four configurations, I can't set it once for every one.
The Windows and Linux toolchains aren't the same, so they can't share settings across them.
I can share settings across configurations of the same toolchain, so setting include and link lib for both Linux configs can be shared.
Then the Linux ARM dynamic lib for hardware float.
This is the content of the library folder for these configurations.
In the GCC linker, you do not mention the lib at the start and the .so at the end:
You can now build the two configurations:
Then execute the Debug configuration from previous post.
This will upload the binary to the Linux box and start the debugger.
I had previously installed the shared library.(see prerequisites > Library)
|Part 1: preview|
|Part 2: start multi-target project|
|Part 3: debug on both platforms|
|Part 4a: link 3rd party library on Linux ARM|
|Part 4b: link 3rd party library on Windows|