Compilation error in RadioHead library example sketch

Hi, I am quite new to Arduino programming and i want to use RadioHead library for RF communication. I took the reference from this .

But when I tried to compile an example code i.e., simulator for the server I am getting the following error.

Arduino: 1.8.11 (Windows 10), Board: "Arduino Uno"

C:\Users.....\AppData\Local\Temp\2\ccXFHWUA.ltrans0.ltrans.o: In function `global constructors keyed to 65535_0_simulator_reliable_datagram_server.pde.cpp.o.5791':

:(.text.startup+0x7e): undefined reference to `RH_TCP::RH_TCP(char const*)'

collect2.exe: error: ld returned 1 exit status

exit status 1
Error compiling for board Arduino Uno.

Please help me resolve this issue.i googled a lot but didn't find any answer.Thank you :slight_smile:

From RadioHead/RH_TCP.cpp:

// This can only build on Linux and compatible systems
#if (RH_PLATFORM == RH_PLATFORM_UNIX) 

#include <RH_TCP.h>
#include <sys/types.h>
#include <errno.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <netdb.h>
#include <string>

RH_TCP::RH_TCP(const char* server)
    : _server(server),
      _rxBufLen(0),
      _rxBufValid(false),
      _socket(-1)
{
}

The examples sketches under File > Examples > RadioHead > simulator are meant to be run on a computer, not on an Arduino board. So you can't use them with the Arduino IDE. If you want to run them on your computer, follow the instructions in the comment at the top of the sketch:

// Tested on Linux
// Build with
// cd whatever/RadioHead 
// tools/simBuild examples/simulator/simulator_reliable_datagram_server/simulator_reliable_datagram_server.pde
// Run with ./simulator_reliable_datagram_server
// Make sure you also have the 'Luminiferous Ether' simulator tools/etherSimulator.pl running

Otherwise, you can use the Arduino IDE to upload any of the examples other than the ones under the simulator folder to your Arduino board.

Thanks a lot .it worked from linux command line :slight_smile:

You're welcome. I'm glad to hear it's working. Enjoy!
Per