finally just able to compile the c code with proper flags and linker library