Those are linker errors :
collect2: ld returned 1 exit status
I initially thought that you were not linking your code with the hidapi library, but the only way I accidentally managed to reproduce the exact errors you had was by putting the gcc parameters in the wrong order. This fails with the same output :
$ g++ -c -Ihidapi hidtest/hidtest.cpp -o hidtest/hidtest.o
$ g++ -Llinux/.libs -lhidapi-hidraw hidtest/hidtest.o -o test
Your object file needs to appear before the library in the gcc arguments for the linking stage.
The following works just fine :
$ g++ -c -Ihidapi hidtest/hidtest.cpp -o hidtest/hidtest.o
$ g++ -Llinux/.libs hidtest/hidtest.o -lhidapi-hidraw -o test
$ LD_LIBRARY_PATH=linux/.libs ./test
Note that I have to use -I, -L and LD_LIBRARY_PATH because I did not install hidapi, I did everything from the hidapi source folder.