bodokaiser
bodokaiser

Reputation: 15752

How to link with linux/gpio.h?

I want to compile following c file:

#include <stdio.h>
#include <stdlib.h>
#include <../deps/linux/gpio.h>

int main(void) {
    int r = gpio_is_valid(31);

    if (r == -1) {
        perror("GPIO address is invalid.\n");
        exit(EXIT_FAILURE);
    }


    return EXIT_SUCCESS;
}

My Makefile looks as

build: gpio

LDFLAGS = -Llinux

gpio:
    $(CC) -o gpio.o src/gpio.c $(LDFLAGS)

Unfortunately I get "gpio.h not found" as error.

Upvotes: 1

Views: 3505

Answers (1)

alk
alk

Reputation: 70951

gpio.h is a Linux kernel header. It can not be used for user space programs.

Upvotes: 2

Related Questions