/*********************************************************************************
* FreeModbus LINUXTCP Compile ERROR
* 说明:
* 想使用FreeModbus TCP在Ubuntu上进行测试,结果其默认没有打开TCP功能。
*
* 2018-1-2 深圳 南山平山村 曾剑锋
********************************************************************************/ 一、参考文档:
. http://pl.comp.lang.c.narkive.com/3s8TevOZ/problem-z-kompilacj 二、报错信息:
/home/zengjf/freemodbus/freemodbus-v1.5.0/demo/LINUXTCP/demo.c:: undefined reference to `eMBTCPInit'
../../modbus/mb.o: In function `eMBInit':
/home/zengjf/freemodbus/freemodbus-v1.5.0/demo/LINUXTCP/../../modbus/mb.c:: undefined reference to `eMBRTUStart'
/home/zengjf/freemodbus/freemodbus-v1.5.0/demo/LINUXTCP/../../modbus/mb.c:: undefined reference to `eMBRTUStop'
/home/zengjf/freemodbus/freemodbus-v1.5.0/demo/LINUXTCP/../../modbus/mb.c:: undefined reference to `eMBRTUSend'
/home/zengjf/freemodbus/freemodbus-v1.5.0/demo/LINUXTCP/../../modbus/mb.c:: undefined reference to `eMBRTUReceive'
/home/zengjf/freemodbus/freemodbus-v1.5.0/demo/LINUXTCP/../../modbus/mb.c:: undefined reference to `vMBPortClose'
/home/zengjf/freemodbus/freemodbus-v1.5.0/demo/LINUXTCP/../../modbus/mb.c:: undefined reference to `xMBRTUReceiveFSM'
/home/zengjf/freemodbus/freemodbus-v1.5.0/demo/LINUXTCP/../../modbus/mb.c:: undefined reference to `xMBRTUTransmitFSM'
/home/zengjf/freemodbus/freemodbus-v1.5.0/demo/LINUXTCP/../../modbus/mb.c:: undefined reference to `xMBRTUTimerT35Expired'
/home/zengjf/freemodbus/freemodbus-v1.5.0/demo/LINUXTCP/../../modbus/mb.c:: undefined reference to `eMBRTUInit'
/home/zengjf/freemodbus/freemodbus-v1.5.0/demo/LINUXTCP/../../modbus/mb.c:: undefined reference to `eMBASCIIStart'
/home/zengjf/freemodbus/freemodbus-v1.5.0/demo/LINUXTCP/../../modbus/mb.c:: undefined reference to `eMBASCIIStop'
/home/zengjf/freemodbus/freemodbus-v1.5.0/demo/LINUXTCP/../../modbus/mb.c:: undefined reference to `eMBASCIISend'
/home/zengjf/freemodbus/freemodbus-v1.5.0/demo/LINUXTCP/../../modbus/mb.c:: undefined reference to `eMBASCIIReceive'
/home/zengjf/freemodbus/freemodbus-v1.5.0/demo/LINUXTCP/../../modbus/mb.c:: undefined reference to `vMBPortClose'
/home/zengjf/freemodbus/freemodbus-v1.5.0/demo/LINUXTCP/../../modbus/mb.c:: undefined reference to `xMBASCIIReceiveFSM'
/home/zengjf/freemodbus/freemodbus-v1.5.0/demo/LINUXTCP/../../modbus/mb.c:: undefined reference to `xMBASCIITransmitFSM'
/home/zengjf/freemodbus/freemodbus-v1.5.0/demo/LINUXTCP/../../modbus/mb.c:: undefined reference to `xMBASCIITimerT1SExpired'
/home/zengjf/freemodbus/freemodbus-v1.5.0/demo/LINUXTCP/../../modbus/mb.c:: undefined reference to `eMBASCIIInit'
collect2: error: ld returned exit status
Makefile:: recipe for target 'tcpmodbus' failed
make: *** [tcpmodbus] Error 三、解决办法:
. modified the file "freemodbus/modbus/include/mbconfig.h"
. 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# make
gcc -g -Wall -Iport -I../../modbus/rtu -I../../modbus/ascii -I../../modbus/include -I../../modbus/tcp -pthread -o demo.o -c demo.c
gcc -g -Wall -Iport -I../../modbus/rtu -I../../modbus/ascii -I../../modbus/include -I../../modbus/tcp -pthread -o port/portother.o -c port/portother.c
gcc -g -Wall -Iport -I../../modbus/rtu -I../../modbus/ascii -I../../modbus/include -I../../modbus/tcp -pthread -o port/portevent.o -c port/portevent.c
gcc -g -Wall -Iport -I../../modbus/rtu -I../../modbus/ascii -I../../modbus/include -I../../modbus/tcp -pthread -o port/porttcp.o -c port/porttcp.c
gcc -g -Wall -Iport -I../../modbus/rtu -I../../modbus/ascii -I../../modbus/include -I../../modbus/tcp -pthread -o ../../modbus/mb.o -c ../../modbus/mb.c
gcc -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.c
gcc -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.c
gcc -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.c
gcc -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.c
gcc -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.c
gcc -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.c
gcc -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.c
gcc -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.c
gcc 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 tcpmodbus
root@localhost:/home/zengjf/freemodbus/freemodbus-v1.5.0/demo/LINUXTCP#

最新文章

  1. 利用TabHost制作QQ客户端标签栏效果(低版本QQ)
  2. 数据库视图 (View)和EntityFramework Code First结合使用
  3. 2. javacript高级程序设计-在HTML中使用JavaScript
  4. mySQL中如何给某一IP段的用户授权?
  5. UE4 减少APK包的大小
  6. centos 5.8 64位系统安装 mysql5.6
  7. dede 5.7进后台卡死解决办法
  8. iostat的深入理解
  9. spring利用注解来注册bean到容器
  10. 无奈卸载Clover 转投TotalCommand
  11. HDOJ-ACM1023(JAVA)
  12. session原理解析
  13. Linux(CentOS6.4、CentOS6.3)下安装、配置PostgreSQL9.2
  14. page cache和buffer cache
  15. SpringData JPA的学习笔记之环境搭建
  16. webpack loader加载器
  17. 2018-2019-1-20165221&20165225 《信息安全系统设计》实验五:通讯协议设计
  18. jade模板 注意事项
  19. abap test seam 和 TEST-INJECTION
  20. OneNET麒麟座应用开发之六:与气体质量流量控制器通讯

热门文章

  1. openssh安装/更新教程(CentOS)
  2. Find a way out of the ClassLoader maze
  3. sigmoid belief network boltszmann machine
  4. mips编译器交叉编译openssl
  5. hMailServer SSL 配置
  6. 二十. Python基础(20)--面向对象的基础
  7. python常见面试题(mark)
  8. SQL-27 给出每个员工每年薪水涨幅超过5000的员工编号emp_no、薪水变更开始日期from_date以及薪水涨幅值salary_growth,并按照salary_growth逆序排列。 提示:在sqlite中获取datetime时间对应的年份函数为strftime('%Y', to_date)
  9. DevExpress WinForms使用教程:Data Grid - Find Panel模式
  10. 杭电多校第三场 A Ascending Rating