Let me preface by saying I am a newbie learning C. I am really pounding my head against the wall. I am using a header file that has a function suchandsuch () when I am calling this function from the main I am getting "undefined reference" error like it is not seeing the header file. I am using linux and eclipse.

Here are clips from the files to implement:

Main (main.c)

#include "modbus.h"

int main(void)
{
int socket;
modbus_t *ctx;
modbus_mapping_t *mb_mapping;

ctx = modbus_new_tcp("127.0.0.1", 1502); /*this is the error for undefined*/

HeaderFile1 (modbus.h)

#include "modbus-tcp.h"
#include "modbus-rtu.h"

HeaderFile2 (modbus-tcp.h)

#include modbus.h

modbus_t* modbus_new_tcp(const char *ip_address, int port);
/*Here is where the function is*/



This seems to be pretty straight forward which is making me think it is something I am doing on the eclipse ide incorrectly. If it matters I am using Linux/Ubuntu and the header files are in usr/include/modbus. Any help would be greatly appreciated!