I build the hidapi on windows using Visual Studios. The build generated a 'hidapi.lib' file. Now I am trying to write C code using Eclipse IDE and have included the 'hidapi.lib' by changing it's name to 'libhid.lib'. The hidapi.h is also present and included. The error comes when I try to access any of the functions of the hidapi.h The compiler gives an undefined reference error everytime I run the program. Where am Igoing wrong ?
/* ============================================================
Name : hid_attemp1.c
Author : Shantanu
Version :
Copyright : Your copyright notice
Description : Hello World in C, Ansi-style
===============================================================*/
#ifdef WIN32
#include <windows.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include "hidapi.h"
int main(void) {
int r;
r = hid_init();
if(r<0)
printf("error in init()\n");
return EXIT_SUCCESS;
}
I tried creating a C project on visual studio, included the hidapi.h and linked the hidapi.lib to the project. The project build successfully and I was able to run it. As far as I am concerned, the problem is the incompatibility of the 'hidapi.lib' between the Visual Studio and Eclipse IDE.