1

How can I use WiringPi library through SSH on Netbeans? When I run a simple HelloWorld program, it works.

This is the output message:

Copying project files to /root/.netbeans/remote/RASPBERRYPI/win-7pjgqkgjsj4-Windows-x86_64 at root@RASPBERRYPI
Building project files list...
Checking directory structure...
Checking previously uploaded files...
Checking links...
Uploading changed files:
    Zipping 10 changed files...
    Uploading zip to root@RASPBERRYPI...
    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
4

1 回答 1

2

这是一篇很老的帖子,但是由于我遇到了同样的问题并且我已经解决了,我现在正在写下解决方案,所以如果有人需要,它已经准备好了;)

唯一要做的就是在编译命令中添加一些参数,特别是二进制文件和包含的路径以及 -lwiringpi 选项。

要在 NetBeans 中执行此操作,请右键单击项目,然后单击属性。从那里,构建-> C 编译器。

现在,找到语音附加选项,打开它并复制粘贴以下内容:

-I/usr/local/include -L/usr/local/lib -lwiringPi

(这是标准安装wiringPi的路径,如果您更改了库的位置,请相应地更改路径)

现在它应该可以工作了,至少它对我有用。

希望它对某人有所帮助,再见

编辑:

我忘了补充说你必须以 root 用户身份 ssh,否则wiringPi 不起作用。

为此,您必须这样做:

密码根

设置root密码

须藤纳米 /etc/ssh/sshd_config

并将 PermitRootLogin 更改为 yes

重启

于 2017-02-15T20:08:03.013 回答