linux freemodbus tcp,FreeModbus LINUXTCP Compile ERROR

/*********************************************************************************

* 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#

VBA Excel WideCharToMultiByte Compile error on 64-bit System

Compile Error: The code in this project must be updated for use on64-bit systems. Please review and ...

OK335xS canutils deal with compile error

/************************************************************************************** * OK335xS ca ...

Handling CLIK AS3 Compile Error 1152 & 5000

Handling CLIK AS3 Compile Error 1152 & 5000 Action You add a CLIK AS3 component from CLIK_Compon ...

ASIHTTPREQUEST framework compile error when method is called / link error

never mind!!! duplicate: Error with iOS 5.1 when i use ASIHTTPRequest and SBJSON "I would take ...

compile error

stray \241     程序有非法字符,如空格,引号等,一般因为从别的地方粘贴导致这个错误.

Visual Studio Code compile error - launch.json must be configured...

一.在最初使用VS Code创建控制台应用时, 使用VS Code调试工具默认会跑出异常: launch: program 'launch: launch.json must be configure ...

随机推荐

Unity引擎下最快的Xml读取器:UnityRapidXml

近期发现无论是系统的System.Xml还是Mono.Xml,其实都有这样或者那样的问题,所以决定自己搞一个快一点的xml parse.以前在C++里用过rapidxml,这个确实是神一般的存在,速度 ...

matlab的滤波器仿真——低通滤波器与插值滤波器

项目里面有用到插值滤波器的场合,用matlab做了前期的滤波器性能仿真,产生的滤波器系数保存下来输入到FPGA IP中使用即可. 下面是仿真的代码 % clear all close all Nx = ...

Nginx-->进阶-->Module-->ngx_http_stub_status_module

一.模块介绍 The ngx_http_stub_status_module module provides access to basic status information. This modu ...

URAL 1780 G - Gray Code 找规律

G - Gray CodeTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/view ...

STM32 定时器用于外部脉冲计数

STM32 定时器用于外部脉冲计数 第一步,设置GPIO GPIO_InitTypeDef GPIO_InitStructure; /* PA0,PA12-> 左右脉冲输入 */GPIO_Ini ...

[MIREX] MIREX评测介绍

MIREX作为国际最权威音频检索评测大赛,竟然在百度上找不到任何介绍,只有几个与什么搜狗.腾讯获得什么成绩相关的检索内容,相比而言,TRECVID的内容收到重视多了...由于研究生阶段主要研究音频领域 ...

php 带cookie登陆

设置 git config 的一些默认配置

设置 git status的颜色. git config --global color.status auto 一.Git已经在你的系统中了,你会做一些事情来客户化你的Git环境.你只需要做这些设置一 ...

使用URLConnection提交请求

URL的openConnection()方法将返回一个URLConnection对象,该对象表示应用程序和URL之间的通信连接.程序可以通过URLConnection实例向该URL发送请求,读取URL ...

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值