문제

So, I have a simple c program on my Raspberry Pi, that is using the GPIO pins. When I compile it, i have to add -l bcm2835 after the gcc for the library of the GPIO.

Now I have another program which I have to compile with make, so I have to edit my Makefile to include this bcm2835 library.

I know the basics of a makefile but wherever I try to put it in my makefile, it's not working.

Can I have a simple answer to where I have to edit my makefile, it would be highly appreciated.

도움이 되었습니까?

해결책

You can pass it as you would with any other flag.

#makefile

CC=gcc
CFLAGS= -g -c -Wall 
MYLIB= -lbcm2835
program:   dependencies 
 <  TAB IT!>${CC} ${CFLAGS} ${MYLIB} -o Obj dependencies
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top