2017-02-25 109 views
0

我試圖使用wiringPI的wiringPilSR將中斷附加到引腳。我的代碼如下所示:函數隱式聲明'wiringPilSR'

#include <wiringPi.h> 
#include <stdio.h> 

int inPin = 3; 

void myInterrupt(); 

int main(vodi){ 
    wiringPilSetupGpio(); 
    pinMode(inPin, INPUT); 
    wiringPilSR(inPin, INT_EDGE_RISING, &myInterrupt); 
    while(1){ 
     printf("Cycle repeated\n"); 
     delay(1000); 
    } 
    return 0; 
} 

void myInterrupt(){ 
    printf("Interrupted"); 
    return 0; 
} 

當我嘗試建立在Geany的代碼,我得到一個警告「implicit declaration of function 'wiringPilSR'」錯「undefined reference to 'wiringPilSR'」。我已經設置了構建命令如本tutorial on sparkfun

+0

'wiringPilSR'的定義是什麼? –

+0

想通了。無論如何感謝 – Alexander

回答

1

功能wiringPilSR不與小寫L (l)拼寫,而不是它的第9個字符是一個大寫i (I)

那還有一小時計算出來

+1

中斷服務程序...:D –