2016-09-03 30 views
1
使用WiringPi C庫通過SSH

我如何使用WiringPi庫通過NetBeans上SSH?當我運行一個簡單的HelloWorld程序時,它可以工作。的NetBeans

這是輸出消息:

Copying project files to /root/.netbeans/remote/RASPBERRYPI/win-7pjgqkgjsj4-Windows-x86_64 at [email protected] 
Building project files list... 
Checking directory structure... 
Checking previously uploaded files... 
Checking links... 
Uploading changed files: 
    Zipping 10 changed files... 
    Uploading zip to [email protected] 
    Unzipping changed files... 
Checking exec permissions... 
Uploading changed files finished successfully. 

cd '/root/.netbeans/remote/RASPBERRYPI/win-7pjgqkgjsj4-Windows-x86_64/C/Users/Public/Remote Projects/BlinkingLED' 
/usr/bin/make -f Makefile CONF=Debug 
"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf 
make[1]: Entering directory '/root/.netbeans/remote/RASPBERRYPI/win-7pjgqkgjsj4-Windows-x86_64/C/Users/Public/Remote Projects/BlinkingLED' 
"/usr/bin/make" -f nbproject/Makefile-Debug.mk dist/Debug/GNU-Linux/blinkingled 
make[2]: Entering directory '/root/.netbeans/remote/RASPBERRYPI/win-7pjgqkgjsj4-Windows-x86_64/C/Users/Public/Remote Projects/BlinkingLED' 
mkdir -p build/Debug/GNU-Linux 
rm -f "build/Debug/GNU-Linux/main.o.d" 
gcc -c -g -std=c11 -MMD -MP -MF "build/Debug/GNU-Linux/main.o.d" -o build/Debug/GNU-Linux/main.o main.c 
mkdir -p dist/Debug/GNU-Linux 
gcc  -o dist/Debug/GNU-Linux/blinkingled build/Debug/GNU-Linux/main.o 
build/Debug/GNU-Linux/main.o: In function `main': 
/root/.netbeans/remote/RASPBERRYPI/win-7pjgqkgjsj4-Windows-x86_64/C/Users/Public/Remote Projects/BlinkingLED/main.c:24: undefined reference to `wiringPiSetup' 
/root/.netbeans/remote/RASPBERRYPI/win-7pjgqkgjsj4-Windows-x86_64/C/Users/Public/Remote Projects/BlinkingLED/main.c:29: undefined reference to `pinMode' 
/root/.netbeans/remote/RASPBERRYPI/win-7pjgqkgjsj4-Windows-x86_64/C/Users/Public/Remote Projects/BlinkingLED/main.c:32: undefined reference to `digitalWrite' 
/root/.netbeans/remote/RASPBERRYPI/win-7pjgqkgjsj4-Windows-x86_64/C/Users/Public/Remote Projects/BlinkingLED/main.c:34: undefined reference to `delay' 
/root/.netbeans/remote/RASPBERRYPI/win-7pjgqkgjsj4-Windows-x86_64/C/Users/Public/Remote Projects/BlinkingLED/main.c:35: undefined reference to `digitalWrite' 
/root/.netbeans/remote/RASPBERRYPI/win-7pjgqkgjsj4-Windows-x86_64/C/Users/Public/Remote Projects/BlinkingLED/main.c:37: undefined reference to `delay' 
collect2: error: ld returned 1 exit status 
nbproject/Makefile-Debug.mk:62: recipe for target 'dist/Debug/GNU-Linux/blinkingled' failed 
make[2]: *** [dist/Debug/GNU-Linux/blinkingled] Error 1 
make[2]: Leaving directory '/root/.netbeans/remote/RASPBERRYPI/win-7pjgqkgjsj4-Windows-x86_64/C/Users/Public/Remote Projects/BlinkingLED' 
nbproject/Makefile-Debug.mk:59: recipe for target '.build-conf' failed 
make[1]: *** [.build-conf] Error 2 
make[1]: Leaving directory '/root/.netbeans/remote/RASPBERRYPI/win-7pjgqkgjsj4-Windows-x86_64/C/Users/Public/Remote Projects/BlinkingLED' 
nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed 
make: *** [.build-impl] Error 2 

回答

2

這是一個很老的文章,但因爲我有同樣的問題,我已經解決它,我現在寫下的解決方案,因此,如果有人需要它,它已經準備好;)

做的唯一一件事就是一些參數的路徑添加到編輯命令,特別是二進制文件,包括加-lwiringpi選項。

要做到這一點在NetBeans中,右擊該項目,然後選擇屬性。從那裏,Build-> C編譯器。

現在,發現聲音的附加選項,打開它,複製粘貼以下:

-I在/ usr /本地/ -L包括在/ usr/local/lib目錄-lwiringPi

(即是路徑標準安裝wiringPi的,如果你已經改變了庫的位置相應地改變

現在,它應該工作的路徑),至少它爲我工作。

希望它可以幫助別人, 再見

編輯:

我忘了補充一點,你必須ssh作爲root用戶,否則wiringPi不起作用。

對於您必須做到:

passwd的根

設置root密碼

須藤納米/等/ SSH/sshd_config中

和變革的PermitRootLogin爲yes

重啓