【问题标题】:Using WiringPi C library through SSH on Netbeans在 Netbeans 上通过 SSH 使用 WiringPi C 库
【发布时间】:2016-09-03 17:32:49
【问题描述】:

如何在 Netbeans 上通过 SSH 使用 WiringPi 库?当我运行一个简单的 HelloWorld 程序时,它可以工作。

这是输出消息:

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

【问题讨论】:

    标签: ssh raspberry-pi wiringpi


    【解决方案1】:

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

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

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

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

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

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

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

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

    编辑:

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

    为此,您必须这样做:

    密码根

    设置root密码

    sudo nano /etc/ssh/sshd_config

    并将 PermitRootLogin 更改为 yes

    重启

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-12-02
      • 2015-05-17
      • 1970-01-01
      • 1970-01-01
      • 2015-08-06
      相关资源
      最近更新 更多