Clion Remote Pi:对connectionPiSetup的未定义引用

时间:2019-06-18 07:37:51

标签: c cmake raspberry-pi clion wiringpi

我正在尝试使用wirePiPi库通过clion IDE运行c程序。 Hello world运行良好,因此我可以确保与pi的连接已正确建立。但是,当我添加connectioningPi-Library #include并运行connectionPictureSetup()时;我收到一条错误消息。

为了解决此问题,我在Clion / Preferences / Build,Execution,Deployment / CMake / Build选项中添加了“ -lwiringPi”。但是,这没有任何改变。也许在CMakeLists.c中缺少一些东西,但我实际上不知道什么。

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

// Code I want to make running
int main() {
    wiringPiSetup();
    return 0;
}

错误消息:

==================== [构建| write_morse |调试远程] ====================== / usr / local / bin / cmake --build /tmp/tmp.tL61Mxt6gP/cmake-build-debug-remote --target write_morse--j 4 [50%]链接C可执行文件write_morse CMakeFiles / write_morse.dir / main.c.o:在函数main': /tmp/tmp.tL61Mxt6gP/main.c:6: undefined reference to wiringPiSetup'中 collect2:错误:ld返回1退出状态 CMakeFiles / write_morse.dir / build.make:83:目标“ write_morse”的配方失败 make [3]: * [write_morse]错误1 CMakeFiles / Makefile2:72:目标'CMakeFiles / write_morse.dir / all'的配方失败 make [2]: [CMakeFiles / write_morse.dir / all]错误2 CMakeFiles / Makefile2:84:目标'CMakeFiles / write_morse.dir / rule'的配方失败 make [1]: [CMakeFiles / write_morse.dir / rule]错误2 Makefile:118:目标“ write_morse”的配方失败 make:* [write_morse]错误2

带有-lwiringPi的错误消息:

==================== [构建| write_morse |调试远程] ====================== / usr / local / bin / cmake --build /tmp/tmp.tL61Mxt6gP/cmake-build-debug-remote --target write_morse--lwiringPi [50%]链接C可执行文件write_morse CMakeFiles / write_morse.dir / main.c.o:在函数main': /tmp/tmp.tL61Mxt6gP/main.c:6: undefined reference to wiringPiSetup'

CMakeList.txt

cmake_minimum_required(VERSION 3.14)
project(write_morse C)

set(CMAKE_C_STANDARD 99)

add_executable(write_morse main.c)

0 个答案:

没有答案