tranter / blogs

Files associated with ICS blog posts.
BSD Zero Clause License
19 stars 17 forks source link

Compiler issue with example #2

Closed seamusdemora closed 4 months ago

seamusdemora commented 11 months ago

Hello,

Copied your example from your blog post, and stored it in the file ~/blinky_c/blinky-i.c. Tried compilation as follows:

$ gcc -o blinky -gpiod blinky-i.c
gcc: error: unrecognized debug output level ‘piod’

No idea where this comes from as I've checked the source file, and found no instance of piod.

My system is RPi 5 running bookworm w/Kernel: 6.1.0-rpi7-rpi-2712

tranter commented 11 months ago

The correct compile command line would be something like this:

gcc -o blinky blink-i.c -l gpiod

Or better yet, use the source code here https://github.com/tranter/blogs/tree/master/gpio/part9 and use CMake to build it.

seamusdemora commented 11 months ago

Thank you! I was following some answer from SO without checking/verifying it.

And thanks (again) for the tip about CMake; I'm just reading about it now. AIUI so far, it's a build system for cross-compilation. I don't need that at present as I'm compiling everything directly on my Pi, but it's surely a good thing to know about for larger compile jobs.

tranter commented 4 months ago

Resolved.