Hi,
I am trying to use the oath-toolkit lib to test totp but i am having a
problem when i try to compile my "test" program with the liboath library.
Sorry for asking this here but i am sutcked for the last 2 days.
here is the information:
Library is installed from oath-toolkit source, compilation and installation
without problems.
aj@aj-LINUX:~/totp$ sudo ldconfig -v | grep liboath
liboath.so.0 -> liboath.so.0.1.3
My main.cpp "test" program:
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <liboath/oath.h>
int main(int argc, char *argv[]){
int rc=1;
const char* secret="001122";
size_t secretlen=0;
size_t window=0;
unsigned digits=6;
char resultado[10];
time_t now, when, t0,time_step_size;
rc=oath_init(); // THE ONLY TEST TO CHECK LIBOATH LINK
if (rc == 0)
printf("liboath: %i\n",OATH_OK);
return 0;
}
Compilation command:
aj@aj-LINUX:~/totp$ g++ main.cpp -loath -o teste
/tmp/ccXbve8u.o: In function `main':
main.cpp:(.text+0x45): undefined reference to `oath_init()'
collect2: error: ld returned 1 exit status
Checking library, oath_init() function is at the library as expected:
aj@aj-LINUX:~/totp$ strings /usr/local/lib/liboath.so | grep oath_init
*oath_init*
Oathtool is also working
aj@aj-LINUX:~/totp$ oathtool 0011 -v
Hex secret: 0011
Base32 secret: AAIQ====
Digits: 6
Window size: 0
Start counter: 0x0 (0)
325473
I have tried everything I know to find the problem, but i had no success.
I am using Ubuntu 13 and oathtoolkit version 2.0.2
Any help will be very much appreciated.
Alan Jorge Markus