Here's a link to the tarball of the library:
https://www.kernel.org/pub/software/libs/libgpiod/libgpiod-2.1.3.tar.xz
- After untarring, go into the resulting libgpiod-2.1.3 directory and
follow the README file to build the library:
● ./configure --enable-bindings-cxx --prefix=/usr/local
● make
● sudo make install
This will generate:
□ Headers have been installed in: /usr/local/include
gpiodcxx/ gpiod.h gpiod.hpp
□ Libraries have been installed in: /usr/local/lib
libgpiod.a libgpiodcxx.la* libgpiodcxx.so.2@ libgpiod.la*
libgpiod.so.3@ pkgconfig/
libgpiodcxx.a libgpiodcxx.so@ libgpiodcxx.so.2.1.0* libgpiod.so@
libgpiod.so.3.1.2*
In the untarred libgpiod-2.1.3 directory you'll find an examples directory
for C-language sources (which also don't work) and a bindings/cxx directory
of the library classes, and bindings/cxx/examples which is the examples
that I am having problems with not compiling.
$ g++ reconfigure_input_to_output.cpp
> reconfigure_input_to_output.cpp:18:22: error: ‘offset’ in ‘class
> gpiod::line’ does not name a type
> 18 | const ::gpiod::line::offset line_offset = 5;
> | ^~~~~~
> reconfigure_input_to_output.cpp: In function ‘int main()’:
> reconfigure_input_to_output.cpp:26:33: error: ‘class gpiod::chip’ has no
> member named ‘prepare_request’
> 26 | .prepare_request()
> | ^~~~~~~~~~~~~~~
> reconfigure_input_to_output.cpp:29:40: error: ‘line_offset’ was not
> declared in this scope
> 29 | line_offset,
> | ^~~~~~~~~~~
> reconfigure_input_to_output.cpp:30:49: error: ‘line_settings’ is not a
> member of ‘gpiod’
> 30 |
> ::gpiod::line_settings().set_direction(
> | ^~~~~~~~~~~~~
> reconfigure_input_to_output.cpp:31:63: error: ‘gpiod::line::direction’ is
> not a class, namespace, or enumeration
> 31 |
> ::gpiod::line::direction::INPUT))
> |
> ^~~~~~~~~
> reconfigure_input_to_output.cpp:37:56: error: ‘gpiod::line::value’ has not
> been declared
> 37 |
> ::gpiod::line::value::ACTIVE ?
> | ^~~~~
> reconfigure_input_to_output.cpp:43:44: error: ‘line_config’ is not a
> member of ‘gpiod’
> 43 |
> request.reconfigure_lines(::gpiod::line_config().add_line_settings(
> | ^~~~~~~~~~~
> reconfigure_input_to_output.cpp:45:26: error: ‘line_settings’ is not a
> member of ‘gpiod’
> 45 | ::gpiod::line_settings()
> | ^~~~~~~~~~~~~
> reconfigure_input_to_output.cpp:46:55: error: ‘gpiod::line::direction’ is
> not a class, namespace, or enumeration
> 46 |
> .set_direction(::gpiod::line::direction::OUTPUT)
> | ^~~~~~~~~
> reconfigure_input_to_output.cpp:47:58: error: ‘gpiod::line::value’ has not
> been declared
> 47 |
> .set_output_value(::gpiod::line::value::INACTIVE)));
> | ^~~~~
> reconfigure_input_to_output.cpp:52:56: error: ‘gpiod::line::value’ has not
> been declared
> 52 |
> ::gpiod::line::value::ACTIVE ?
> | ^~~~~
As a side note, you'll want to build the library in a Linux environment. Or
by adding the --host=aarch64-linux-gnu option to the configure command and
putting your crosscompiler toolchain early in your path, you can build the
library for crosscompiled systems. Note that it does not build for a MinGW
because of missing the ioctl() functionality.
On Sat, May 9, 2026 at 9:03 AM Pete Soper <[email protected]> wrote:
> Send some decent and specific links and compiler messages to the list.
> Pete
>
> May 9, 2026 1:12:59 AM Scott Hall via TriEmbed <[email protected]>:
>
> I am stuck and hope someone in TriEmbed or EMP might know ..
>
> I need to program a Linux process using the libgpiod library's C++
> bindings. Trouble is all the examples in the source repo don't compile, and
> all other forum answers regurgitate the same examples. The same
> environment's rebuilt commandline utilities work fine.
>
> Does anyone have any working example of reading some GPIO lines, and
> setting others?
>
> --
> Scott G. Hall
> Raleigh, NC, USA
> [email protected]
> *”**Failure is the opportunity to begin again more intelligently.” --
> Henry Ford*
>
>
--
--
Scott G. Hall
Raleigh, NC, USA
[email protected]
*”**Failure is the opportunity to begin again more intelligently.” -- Henry
Ford*
_______________________________________________
Triangle, NC Embedded Interest Group mailing list
To post message: [email protected]
List info: http://mail.triembed.org/mailman/listinfo/triembed_triembed.org
TriEmbed web site: https://TriEmbed.org
To unsubscribe, click link and send a blank message:
mailto:[email protected]?subject=unsubscribe
Searchable email archive available at
https://www.mail-archive.com/[email protected]/