MH Ayhm MH Ayhm - 1 year ago 125
C Question

C call function type error

I'm trying to compile this code which call func from "" to decrypt "cfg" file

#include <stdlib.h>
#include <stdio.h>
int restorebackup(const char *tmp_cfg_name,const char *xml_cfg_name);
int ATP_CFM_ExtCustomImportEncryptedUserCfgFile(const char *tmp_cfg_name);
int main(int argc, char **argv)
int ret;
if(argc < 3)
printf("specify temp config file name.\n");
return ret;
int restorebackup(const char *tmp_cfg_name,const char *xml_cfg_name)
int ret=0;
//ret = ATP_CFM_ExtDigVerifyFile(tmp_cfg_name,tmp_cfg_name);
if(ret != 0)
printf("Verify File failed.\n");
return ret;
ret = ATP_CFM_ExtCustomImportEncryptedUserCfgFile(tmp_cfg_name);
return ret;

but got error regarding func type declare

root@kali:~/debian-qemu# gcc h.c -o demo
/tmp/ccVbt5NT.o: In function `restorebackup':
h.c:(.text+0x8c): undefined reference to `ATP_CFM_ExtCustomImportEncryptedUserCfgFile'
collect2: error: ld returned 1 exit status

any help appreciated

Answer Source

The reason you're getting this error is because you're not linking against the required library,

This is not a library you would expect to find in your Debian system as it is unique to the BT device you're trying to hack.

In short - get the lib from your device, cross compile to the device architecture against the lib you extracted from the device and you should be fine.