1
그래서 BCM2835을 설치했지만 "gcc -c main.c"를 사용하여 .c 파일을 컴파일하려고 할 때 다음과 같은 오류가 발생합니다. 나는 리눅스 btw를 컴파일하는 방법에 대해 전혀 모르겠다. 그냥 인터넷상의 내용을 따르라. BCM2835가 설치되었지만 정의되지 않은 참조를 제공함
/tmp/ccSVwHkt.o: In function `main':
main.c:(.text+0x14): undefined reference to `bcm2835_init'
main.c:(.text+0x3c): undefined reference to `bcm2835_gpio_fsel'
main.c:(.text+0x48): undefined reference to `bcm2835_gpio_write'
main.c:(.text+0x50): undefined reference to `bcm2835_delay'
main.c:(.text+0x5c): undefined reference to `bcm2835_gpio_write'
main.c:(.text+0x64): undefined reference to `bcm2835_delay'
collect2: ld returned 1 exit status
이
은 (구글 코드에서 복사)을 main.c의 내용/*
* main.c
*
* Created on: 23-jun.-2013
* Author: Andreas Backx
*/
#include <bcm2835.h>
// Blinks on RPi Plug P1 pin 11 (which is GPIO pin 17)
#define PIN RPI_GPIO_P1_11
int main(int argc, char **argv)
{
// If you call this, it will not actually access the GPIO
// Use for testing
// bcm2835_set_debug(1);
if (!bcm2835_init())
return 1;
// Set the pin to be an output
bcm2835_gpio_fsel(PIN, BCM2835_GPIO_FSEL_OUTP);
// Blink
while (1)
{
// Turn it on
bcm2835_gpio_write(PIN, HIGH);
// wait a bit
bcm2835_delay(500);
// turn it off
bcm2835_gpio_write(PIN, LOW);
// wait a bit
bcm2835_delay(500);
}
bcm2835_close();
return 0;
}
'gcc -c main.c "는 의미가 없습니다. 당신이 사용하고있는 진정한 명령은 무엇입니까? –
그건 내가 사용하고있는 실제 명령입니다 ... –
글쎄, 그게 아마도 당신 문제예요. 나는 대답을 쓸거야. –