
• It facilitates debugging if you are looking for the cause of a problem linked to the Yoctopuce
library;
• It reduces the dependencies on third party components, for example in the case where you
would need to recompile this project for another architecture in many years;
• It does not require the installation of a dynamic library specific to Yoctopuce on the final
system, everything is in the executable.
To integrate the source code, the easiest way is to simply include the
Sources
directory of your
Yoctopuce library into your
IncludePath
, and to add all the files of this directory (including the sub-
directory
yapi
) to your project.
For your project to build correctly, you need to link with your project the prerequisite system libraries,
that is:
• For Windows: the libraries are added automatically
• For Mac OS X:
IOKit.framework
and
CoreFoundation.framework
• For Linux:
libm
,
libpthread
,
libusb1.0
, and
+
Integration as a static library
Integration of the Yoctopuce library as a static library is a simpler manner to build a small executable
which uses Yoctopuce modules. You can quickly compile the program with a single command. You
do not need to install a dynamic library specific to Yoctopuce, everything is in the executable.
To integrate the static Yoctopuce library to your project, you must include the
Sources
directory of
the Yoctopuce library into your
IncludePath
, and add the sub-directory
Binaries/...
corresponding to your operating system into your
libPath
.
Then, for you project to build correctly, you need to link with your project the Yoctopuce library and
the prerequisite system libraries:
• For Windows:
yocto-static.lib
• For Mac OS X:
libyocto-static.a
,
IOKit.framework
, and
CoreFoundation.framework
• For Linux:
libyocto-static.a
,
libm
,
libpthread
,
libusb1.0
, and
+
.
Note, under Linux, if you wish to compile in command line with GCC, it is generally advisable to link
system libraries as dynamic libraries, rather than as static ones. To mix static and dynamic libraries
on the same command line, you must pass the following arguments:
gcc (...) -Wl,-Bstatic -lyocto-static -Wl,-Bdynamic -lm -lpthread -lusb-1.0 -lstdc++
Integration as a dynamic library
Integration of the Yoctopuce library as a dynamic library allows you to produce an executable smaller
than with the two previous methods, and to possibly update this library, if a patch reveals itself
necessary, without needing to recompile the source code of the application. On the other hand, it is
an integration mode which systematically requires you to copy the dynamic library on the target
machine where the application will run (
yocto.dll
for Windows,
libyocto.so.1.0.1
for Mac OS X and
Linux).
To integrate the dynamic Yoctopuce library to your project, you must include the
Sources
directory
of the Yoctopuce library into your
IncludePath
, and add the sub-directory
Binaries/...
corresponding to your operating system into your
LibPath
.
Then, for you project to build correctly, you need to link with your project the dynamic Yoctopuce
library and the prerequisite system libraries:
• For Windows:
yocto.lib
• For Mac OS X:
libyocto
,
IOKit.framework
, and
CoreFoundation.framework
• For Linux:
libyocto
,
libm
,
libpthread
,
libusb1.0
, and
+
.
With GCC, the command line to compile is simply:
10. Using Yocto-RangeFinder with C++
www.yoctopuce.com
63
Содержание Yocto-RangeFinder
Страница 1: ...Yocto RangeFinder User s guide...
Страница 2: ......
Страница 18: ...12 www yoctopuce com...
Страница 26: ...20 www yoctopuce com...
Страница 42: ...36 www yoctopuce com...
Страница 70: ...gcc lyocto lm lpthread lusb 1 0 lstdc 10 Using Yocto RangeFinder with C 64 www yoctopuce com...
Страница 90: ...84 www yoctopuce com...
Страница 120: ...114 www yoctopuce com...
Страница 130: ...124 www yoctopuce com...
Страница 158: ...21 High level API Reference On failure throws an exception or returns a negative error code 152 www yoctopuce com...
Страница 484: ...478 www yoctopuce com...
Страница 488: ...482 www yoctopuce com...
Страница 490: ...23 Characteristics 484 www yoctopuce com...
Страница 491: ......
Страница 492: ......