Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22296

Why am I getting '"undefined reference to `pigpio_start'" when I see the artifacts in /usr/local

$
0
0

I have a simple c file that looks like this...

#include <pigpiod_if2.h>#include <stdio.h>int main(){  int pi = pigpio_start(0, 0);  if (pi < 0)  {     fprintf(stderr, "pigpio initialisation failed (%d).\n", pi);     return 1;  }  printf("Connected to pigpio daemon (%d).\n", pi);}

If I ls the folders I see...

$ls /usr/local/include/pigpiod_if2.h  pigpiod_if.h  pigpio.h

and

$ls /usr/local/lib/libpigpiod_if2.so    libpigpiod_if.so    libpigpio.so    python2.7libpigpiod_if2.so.1  libpigpiod_if.so.1  libpigpio.so.1  python3.7

When I try to compile like

gcc -I/usr/local/include -L/usr/local/lib pig.c -o pig

I get...

pig.c:(.text+0x14): undefined reference to `pigpio_start'

I also see it in the header so I am completely confused.

How do I import the common shared lib properly?


Viewing all articles
Browse latest Browse all 22296

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>