HELP ME COMPLIE FILE "MODBUS-RTU.C" IN FOLDER "SRC"

198 views
Skip to first unread message

Phạm Ngọc Minh

unread,
Nov 2, 2013, 4:13:06 AM11/2/13
to libm...@googlegroups.com
Hi everybody! And thank you for your library Stephane Raimbault ! (sorry everyone about my bad English)

I have a project for my education: Design Smart Bus!

I use Raspberry Pi is master and 2 Arduino is slave ( and 2 Arduino connect 2 RFID reader for each)

I can use modbus-rtu.c in folder "src" in libmodbus for Raspberry master? (i use libmodbus-3.1.0), but i can't complie modbus-rtu.c

this problems: 
(.text+0x34): undefined reference to 'main'
in function '_modbus_rtu_receive':
(.text+0x3dc): undefined reference to '_modbus_receive_msg'

(.text+0x41c): undefined reference to '_modbus_receive_msg'

i'm new work with C. i must write new master modbus or use modbus-rtu.c ?
Please help me! Thanks you so much for your help! 

mon...@gmail.com

unread,
Nov 2, 2013, 4:24:45 AM11/2/13
to libm...@googlegroups.com
i have same issue with you!

Åke Forslund

unread,
Nov 4, 2013, 2:53:26 AM11/4/13
to libm...@googlegroups.com
Hi,

I'm not sure if it will work on an ARM cpu but I think it should.

It sounds as if you are only compiling one file only and you need to build the whole library.

To build it:
cd [libmodbus-dir]
./autogen.sh (requires autotools)
./configure
make
As super user (root)
make install

Then you should be able to include modbus.h into your main file and link against modbus when you compile.

For example how to set up rtu-look in the tests directory and check out the bandwidth test client for example.

libmodbus might be available precompiled for raspbian or other raspberry pi OS. Try to run
  apt-get install libmodbus
as super user.

/Åke

Phạm Ngọc Minh

unread,
Nov 6, 2013, 7:20:55 AM11/6/13
to libm...@googlegroups.com
Thank you so much Åke Forslund! I'm trying! ^^
Reply all
Reply to author
Forward
0 new messages