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

FreeModbus LINUXTCP Compile ERROR的更多相关文章

  1. 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 ...

  2. OK335xS canutils deal with compile error

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

  3. Handling CLIK AS3 Compile Error 1152 & 5000

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

  4. caffe: compile error : undefined reference to `cv::imread(cv::String const&, int)' et al.

    when I compile caffe file : .build_debug/lib/libcaffe.so: undefined reference to `cv::imread(cv::Str ...

  5. 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 ...

  6. caffe: fuck compile error again : error: a value of type "const float *" cannot be used to initialize an entity of type "float *"

    wangxiao@wangxiao-GTX980:~/Downloads/caffe-master$ make -j8find: `wangxiao/bvlc_alexnet/spl': No suc ...

  7. compile error

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

  8. caffe: compile error: Could not open or find file your path~~/resized_data/0 and a total of 2 images .

    I0219 14:48:40.965386 31108 net.cpp:76] Memory required for data: 0I0219 14:48:40.965517 31108 layer ...

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

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

随机推荐

  1. react router @4 和 vue路由 详解(六)vue怎么通过路由传参?

    完整版:https://www.cnblogs.com/yangyangxxb/p/10066650.html 8.vue怎么通过路由传参? a.通配符传参数 //在定义路由的时候 { path: ' ...

  2. pycharm开发工具,使用

    在pycharm中,打的断点,仅在调试模式下,即debug 模式下,才有效 Use Alt + Shift + C to quickly review your recent changes to t ...

  3. laravel的日志服务

    日志服务使用: $app=app(); $log=$app->make('log'); $log->info('post_index',['data'=>'this is post ...

  4. laravel基于Bootstrap的成功和失败的提示信息和验证提示信息

    message.blade.php <!-- 成功提示框 --> @if(Session::has("success")) <div class="al ...

  5. 1-MAVEN 仓库

    本地资源库     MAVEN的本地资源库是用来存储所有项目的依赖关系(插件和其他文件,这个文件被MAVEN 下载到本地文件中.) 可以通过修改MAVEN安装目录下conf/setting.xml配置 ...

  6. 基于iscroll的better-scroll在vue中的使用

    什么是 better-scroll better-scroll 是一个移动端滚动的解决方案,它是基于 iscroll 的重写,它和 iscroll 的主要区别在这里.better-scroll 也很强 ...

  7. RabbitMQ 简单的消息发送与接收

    RabbitMQ是建立在AMQP(Advanced Message Queuing Protocol,高级消息队列协议)基础上的,而AMQP是建立在TCP协议之上的. 因此,RabbitMQ是需要建立 ...

  8. Java获取系统时间的四种方法

    1.Date day=new Date(); SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); ...

  9. 一. Python基础(1)--语法

    一. Python基础(1)--语法 1. 应用程序 1.1 什么是计算机(Computer)? 组成 ①运算器 arithmetic unit; ※ Arithmetic unit and cont ...

  10. 小程序之setData特殊情况 三种情况的wx:if

    比如data{ “a”:{}, "b":{} } 你想完成这样的结构 //创建一个对象 var readyData={} //对象[key] =另一个对象 readyData[ke ...