-
Notifications
You must be signed in to change notification settings - Fork 316
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Redefinition errors between libiio and kernel iio include files #758
Comments
gwendalcr
added a commit
to gwendalcr/libiio
that referenced
this issue
Nov 15, 2021
To prevent conflicts when iio.h and /usr/include/linux/iio/types.h are both included, rename iio_chan_type libiio_chan_type. Check CI/travis/check_kernel.sh still works. Fixes analogdevicesinc#758. Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
gwendalcr
added a commit
to gwendalcr/libiio
that referenced
this issue
Nov 15, 2021
enum iio_chan_type and iio_modifier are already defined in /usr/include/linux/iio/types.h on linux systems. If an application needs to include both (to support iio events for instance), compiler will complains these enums are defined twice. This patch is not without problem: - it works only if compiler supports __has_include (C++17, not 11). - linux system must have latest kernel-headers installed: IIO_MOD_O2 modifier has been added to linux 5.9 kernel. Alter CI/travis/check_kernel.sh accordingly, check it still passes. Fixes analogdevicesinc#758. Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
gwendalcr
added a commit
to gwendalcr/libiio
that referenced
this issue
Nov 16, 2021
enum iio_chan_type and iio_modifier are already defined in /usr/include/linux/iio/types.h on linux systems. If an application needs to include both (to support iio events for instance), compiler will complains these enums are defined twice. This patch is not without problem: - linux system must have latest kernel-headers installed: IIO_MOD_O2 modifier has been added to linux 5.9 kernel. Alter CI/travis/check_kernel.sh accordingly, check it still passes. Fixes analogdevicesinc#758. Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
pcercuei
added a commit
that referenced
this issue
Nov 29, 2021
Add the missing enums from <linux/iio/types.h> and protect all of them from double-definition by wrapping them with the header's protect guards. Fixes #758. Signed-off-by: Paul Cercueil <paul@crapouillou.net>
pcercuei
added a commit
that referenced
this issue
Nov 29, 2021
Add the missing enums from <linux/iio/types.h> and protect all of them from double-definition by wrapping them with the header's protect guards. Fixes #758. Signed-off-by: Paul Cercueil <paul@crapouillou.net>
pcercuei
added a commit
that referenced
this issue
Dec 3, 2021
Add the missing enums from <linux/iio/types.h> and protect all of them from double-definition by wrapping them with the header's protect guards. Fixes #758. Signed-off-by: Paul Cercueil <paul@crapouillou.net>
An issue remains with IIO_CHAN_TYPE_UNKNOWN, which is now used to support hwmon (commit e965bb1 ("Add support for hardware monitoring (hwmon) devices"): It is used in
If the iio types definitions come from the kernel include file, IIO_CHAN_TYPE_UNKNOWN will not be defined. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Writing an application that including libiio iio.h for handling iio buffers and kernel iio include files for handling events, there are redefinition errors between
/usr/include/linux/iio/types.h
and/usr/include/iio.h
:When compiling on linux architecture, would it make sense for ./iio.h to include
<linux/iio/types.h>
?The text was updated successfully, but these errors were encountered: