赞
踩
/home/zby/linshi2/src/steppingmotor_control/src/main.cpp:2:26: fatal error: modbus/modbus.h: 没有那个文件或目录
compilation terminated.
steppingmotor_control/CMakeFiles/control.dir/build.make:62: recipe for target 'steppingmotor_control/CMakeFiles/control.dir/src/main.cpp.o' failed
make[2]: *** [steppingmotor_control/CMakeFiles/control.dir/src/main.cpp.o] Error 1
CMakeFiles/Makefile2:2756: recipe for target 'steppingmotor_control/CMakeFiles/control.dir/all' failed
make[1]: *** [steppingmotor_control/CMakeFiles/control.dir/all] Error 2
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2
Invoking "make -j8 -l8" failed
在我的ubuntu16.04中未安装modbus头文件,需要下载编译安装。
https://libmodbus.org/download/
选择长期稳定版本libmodbus-3.0.8.tar.gz
在/usr/local/文件夹下,使用终端打开,创建modbus文件夹
sudo mkdir modbus
找到刚才下载好的文件libmodbus-3.0.8.tar.gz,复制到刚才创建好的文件夹
sudo cp -i libmodbus-3.0.8.tar.gz /usr/local/modbus/
tar -zxvf libmodbus-3.0.8.tar.gz
./configure
make && make install
如果此处出现以下错误,则需要权限
Linux centos make[2]: *** [install-libLTLIBRARIES] Error 1 make[2]:
Leaving directory `/home/smarton
sudo make
sudo make install
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。