/**********************************************************************************                 FreeModbus LINUXTCP Compile ERROR* 说明:*     想使用FreeModbus TCP在Ubuntu上进行测试,结果其默认没有打开TCP功能。**                                              2018-1-2 深圳 南山平山村 曾剑锋********************************************************************************/一、参考文档:1. http://pl.comp.lang.c.narkive.com/3s8TevOZ/problem-z-kompilacj

二、报错信息:/home/zengjf/freemodbus/freemodbus-v1.5.0/demo/LINUXTCP/demo.c:76: undefined reference to `eMBTCPInit'
    ../../modbus/mb.o: In function `eMBInit':/home/zengjf/freemodbus/freemodbus-v1.5.0/demo/LINUXTCP/../../modbus/mb.c:148: undefined reference to `eMBRTUStart'
    /home/zengjf/freemodbus/freemodbus-v1.5.0/demo/LINUXTCP/../../modbus/mb.c:149: undefined reference to `eMBRTUStop'
    /home/zengjf/freemodbus/freemodbus-v1.5.0/demo/LINUXTCP/../../modbus/mb.c:150: undefined reference to `eMBRTUSend'
    /home/zengjf/freemodbus/freemodbus-v1.5.0/demo/LINUXTCP/../../modbus/mb.c:151: undefined reference to `eMBRTUReceive'
    /home/zengjf/freemodbus/freemodbus-v1.5.0/demo/LINUXTCP/../../modbus/mb.c:152: undefined reference to `vMBPortClose'
    /home/zengjf/freemodbus/freemodbus-v1.5.0/demo/LINUXTCP/../../modbus/mb.c:153: undefined reference to `xMBRTUReceiveFSM'
    /home/zengjf/freemodbus/freemodbus-v1.5.0/demo/LINUXTCP/../../modbus/mb.c:154: undefined reference to `xMBRTUTransmitFSM'
    /home/zengjf/freemodbus/freemodbus-v1.5.0/demo/LINUXTCP/../../modbus/mb.c:155: undefined reference to `xMBRTUTimerT35Expired'
    /home/zengjf/freemodbus/freemodbus-v1.5.0/demo/LINUXTCP/../../modbus/mb.c:157: undefined reference to `eMBRTUInit'
    /home/zengjf/freemodbus/freemodbus-v1.5.0/demo/LINUXTCP/../../modbus/mb.c:162: undefined reference to `eMBASCIIStart'
    /home/zengjf/freemodbus/freemodbus-v1.5.0/demo/LINUXTCP/../../modbus/mb.c:163: undefined reference to `eMBASCIIStop'
    /home/zengjf/freemodbus/freemodbus-v1.5.0/demo/LINUXTCP/../../modbus/mb.c:164: undefined reference to `eMBASCIISend'
    /home/zengjf/freemodbus/freemodbus-v1.5.0/demo/LINUXTCP/../../modbus/mb.c:165: undefined reference to `eMBASCIIReceive'
    /home/zengjf/freemodbus/freemodbus-v1.5.0/demo/LINUXTCP/../../modbus/mb.c:166: undefined reference to `vMBPortClose'
    /home/zengjf/freemodbus/freemodbus-v1.5.0/demo/LINUXTCP/../../modbus/mb.c:167: undefined reference to `xMBASCIIReceiveFSM'
    /home/zengjf/freemodbus/freemodbus-v1.5.0/demo/LINUXTCP/../../modbus/mb.c:168: undefined reference to `xMBASCIITransmitFSM'
    /home/zengjf/freemodbus/freemodbus-v1.5.0/demo/LINUXTCP/../../modbus/mb.c:169: undefined reference to `xMBASCIITimerT1SExpired'
    /home/zengjf/freemodbus/freemodbus-v1.5.0/demo/LINUXTCP/../../modbus/mb.c:171: undefined reference to `eMBASCIIInit'
    collect2: error: ld returned 1 exit statusMakefile:58: recipe for target 'tcpmodbus' failedmake: *** [tcpmodbus] Error 1三、解决办法:1. modified the file "freemodbus/modbus/include/mbconfig.h"2. find the under code/*! \brief If Modbus ASCII support is enabled. */#define MB_ASCII_ENABLED ( 1 )/*! \brief If Modbus RTU support is enabled. */#define MB_RTU_ENABLED ( 1 )/*! \brief If Modbus TCP support is enabled. */#define MB_TCP_ENABLED ( 0 )/*! \brief The character timeout value for Modbus ASCII.change into#define MB_ASCII_ENABLED ( 0 )#define MB_RTU_ENABLED ( 0 )#define MB_TCP_ENABLED ( 1 )四、Compile Output:root@localhost:/home/zengjf/freemodbus/freemodbus-v1.5.0/demo/LINUXTCP# makegcc -g -Wall -Iport -I../../modbus/rtu -I../../modbus/ascii -I../../modbus/include -I../../modbus/tcp -pthread -o demo.o -c demo.cgcc -g -Wall -Iport -I../../modbus/rtu -I../../modbus/ascii -I../../modbus/include -I../../modbus/tcp -pthread -o port/portother.o -c port/portother.cgcc -g -Wall -Iport -I../../modbus/rtu -I../../modbus/ascii -I../../modbus/include -I../../modbus/tcp -pthread -o port/portevent.o -c port/portevent.cgcc -g -Wall -Iport -I../../modbus/rtu -I../../modbus/ascii -I../../modbus/include -I../../modbus/tcp -pthread -o port/porttcp.o -c port/porttcp.cgcc -g -Wall -Iport -I../../modbus/rtu -I../../modbus/ascii -I../../modbus/include -I../../modbus/tcp -pthread -o ../../modbus/mb.o -c ../../modbus/mb.cgcc -g -Wall -Iport -I../../modbus/rtu -I../../modbus/ascii -I../../modbus/include -I../../modbus/tcp -pthread -o ../../modbus/tcp/mbtcp.o -c ../../modbus/tcp/mbtcp.cgcc -g -Wall -Iport -I../../modbus/rtu -I../../modbus/ascii -I../../modbus/include -I../../modbus/tcp -pthread -o ../../modbus/functions/mbfunccoils.o -c ../../modbus/functions/mbfunccoils.cgcc -g -Wall -Iport -I../../modbus/rtu -I../../modbus/ascii -I../../modbus/include -I../../modbus/tcp -pthread -o ../../modbus/functions/mbfuncdiag.o -c ../../modbus/functions/mbfuncdiag.cgcc -g -Wall -Iport -I../../modbus/rtu -I../../modbus/ascii -I../../modbus/include -I../../modbus/tcp -pthread -o ../../modbus/functions/mbfuncholding.o -c ../../modbus/functions/mbfuncholding.cgcc -g -Wall -Iport -I../../modbus/rtu -I../../modbus/ascii -I../../modbus/include -I../../modbus/tcp -pthread -o ../../modbus/functions/mbfuncinput.o -c ../../modbus/functions/mbfuncinput.cgcc -g -Wall -Iport -I../../modbus/rtu -I../../modbus/ascii -I../../modbus/include -I../../modbus/tcp -pthread -o ../../modbus/functions/mbfuncother.o -c ../../modbus/functions/mbfuncother.cgcc -g -Wall -Iport -I../../modbus/rtu -I../../modbus/ascii -I../../modbus/include -I../../modbus/tcp -pthread -o ../../modbus/functions/mbfuncdisc.o -c ../../modbus/functions/mbfuncdisc.cgcc -g -Wall -Iport -I../../modbus/rtu -I../../modbus/ascii -I../../modbus/include -I../../modbus/tcp -pthread -o ../../modbus/functions/mbutils.o -c ../../modbus/functions/mbutils.cgcc demo.o port/portother.o port/portevent.o port/porttcp.o ../../modbus/mb.o ../../modbus/tcp/mbtcp.o ../../modbus/functions/mbfunccoils.o ../../modbus/functions/mbfuncdiag.o ../../modbus/functions/mbfuncholding.o ../../modbus/functions/mbfuncinput.o ../../modbus/functions/mbfuncother.o ../../modbus/functions/mbfuncdisc.o ../../modbus/functions/mbutils.o   -lpthread  -o tcpmodbusroot@localhost:/home/zengjf/freemodbus/freemodbus-v1.5.0/demo/LINUXTCP#  

转载于:https://www.cnblogs.com/zengjfgit/p/8175831.html

FreeModbus LINUXTCP Compile ERROR相关推荐

  1. linux freemodbus tcp,FreeModbus LINUXTCP Compile ERROR

    /********************************************************************************* * FreeModbus LINU ...

  2. OK335xS canutils deal with compile error

    /*************************************************************************************** OK335xS can ...

  3. JRebel启动报错:compile error: cannot find constructor org.zeroturnaround.javarebel.integration.spring

    背景: JRebel版本:2020.2.5.1 SpringBoot版本:2.5.7 在启动的时候报错,信息如下: Cause by:  compile error: cannot find cons ...

  4. {“error“:{“root_cause“:[{“type“:“script_exception“,“reason“:“compile error“,“script_stack“:[“... par

    前言 最近想更新ES里面已经存在的数据,报错 错误如下 {"error":{"root_cause":[{"type":"scri ...

  5. C语言nullptr错误,编译错误'nullptr'未声明的标识符(Compile error 'nullptr' undeclared identifier)...

    编译错误'nullptr'未声明的标识符(Compile error 'nullptr' undeclared identifier) 我打算用Visual Studio 2008 Express编译 ...

  6. linux c 编译报错 Compile error : undefined reference to‘__atomic_fetch_add_4’ 解决方法

    代码如下: #include <opencv2/opencv.hpp> using namespace cv;int main() {Mat img=imread("cornea ...

  7. ODB 之 persist compile error

    今天遇到一个很诡异的问题,报错如下: C:\DiskD\Projects.plus\Kolo\PatientManagement\Common\odb/database.txx(38): error ...

  8. Unity3D入门,compile error

    上手了一个官方的实例项目,Space Shooter,结果添加了模型和背景图之后才发现,一大堆error,大约有100多个"namespace not found",其中大部分都是 ...

  9. VS+Eigen+CUDA compile error: C2244 and MSB3721

    编译环境Eigen3+CUDA9.2+VS2015 错误如下: 解决方式: 将Eigen中的JacobiSVD and BDCSVD里的Index用Eigen::Index替换 http://eige ...

最新文章

  1. 施耐德电气推出 EcoStruxure 过程控制专家,IIOT 再添新利器
  2. 《Node.js核心技术教程》读书笔记---思维导图版
  3. 【arduino】继续用arduino玩CyberPi童芯派之DA音频信号播放
  4. 启明云端分享| 图文+实操+视频,手把手教你Eclipse搭建esp-idf环境
  5. C#开发笔记之03-为什么选择IsNotXXX方法而不是IsXXX方法?
  6. 7 SDImageCache
  7. Blog从Hexo迁移至Wordpress
  8. 屏幕滑动_小米滑盖式可折叠手机渲染图曝光,屏幕不仅可以折叠还可滑动
  9. live2d手机制作软件_live2d制作器手机版
  10. 快速修改本機局域網IP信息
  11. hash表 C++的使用以及理解
  12. 安利几个好用的在线画图网站
  13. mysql分区表检验,MySQL分区表管理
  14. Matlab绘制经纬度地图并添加坐标点
  15. 【动态规划 LIS】JZOJ_6310 glo
  16. 【高等数学】单射,满射,双射的区别
  17. iOS 架构模式 - 简述 MVC, MVP, MVVM 和 VIPER (译)
  18. 1-1:Huawei路由交换技术简单知识
  19. linux usb检测工具,Linux下USB设备检测全教程
  20. conda中的CUDA和自己安装的CUDA的区别

热门文章

  1. OKhttp讲解及各种协议
  2. 【论文笔记】Reinforcement and Imitation Learning for Diverse Visuomotor Skills
  3. html中的宫格怎么做?常用于商品展示等
  4. matlab牵引,基于MATLAB_Simulink的牵引变压器建模与仿真
  5. js拼接URL字符串
  6. 如何为网站配置自己的域名 2-2
  7. UE5 光影基础 阴影全解析 锯齿阴影解决方案 Lumen
  8. 软件工程师如何提高英语文档阅读能力
  9. 商城系统搭建:三方平台入驻与独立部署优缺点对比
  10. 文科专业有什么比较好的文献查找网站吗?