如何修复这些错误“;函数的隐式声明在C99”中无效;及;冲突类型“;在Xcode objective-c中的.c文件中?

如何修复这些错误“;函数的隐式声明在C99”中无效;及;冲突类型“;在Xcode objective-c中的.c文件中?,c,objective-c,iphone,xcode,C,Objective C,Iphone,Xcode,实际上,我正在objective-C中导入.C文件库。我已修复了大部分错误。但下面两个错误我无法解决。。 第一个是:“函数‘read_binary_profile’的隐式声明在C99中无效” 第二个是:“读取二进制配置文件”的冲突类型” 你能帮我解决这个问题吗 下面是代码 #include <math.h> #include <stdlib.h> #include <stdio.h> #include <string.h&

实际上,我正在objective-C中导入.C文件库。我已修复了大部分错误。但下面两个错误我无法解决。。 第一个是:“函数‘read_binary_profile’的隐式声明在C99中无效”

第二个是:“读取二进制配置文件”的冲突类型”

你能帮我解决这个问题吗

下面是代码

    #include <math.h>
    #include <stdlib.h>
    #include <stdio.h>
    #include <string.h>
    #include <time.h>
    #define __EXTRA_CMDL_SERVICE
    #define __TEXT_ERRORS_PRINT

    #include "profile.h"
    #include "vcp-api.h"
    #define PROFILE "/vendor/etc/profile.bix"
    extern char* vcp_errorv(err_t err);
    vcp_profile_t* read_binary_profile(void* pmem, int allocate);

    vcp_profile_t *p;
    void *b_profile ;
    mem_reg_t reg[NUM_MEM_REGIONS];
    void *smr[NUM_MEM_REGIONS];
    #define FRAME_VCP  80//120      //  Frame handle lenght 120: 7.5ms 16Bit, 16K  so defined here,   but buffer lenght is 120* size of short
    short *input_frame[4];
    short *spk[2];
    short aec[FRAME_VCP] ;   //¥À¥¶»Áπ˚√ª”–ACE , ø…“‘”√ø’ ˝◊È

    void alango_vcp_init()
{
    unsigned int smem = 16000; //1792;
    void *mem;
    err_t err;
    FILE *fp, *fp2 ;
    int flen , fsize ;

    fp=fopen(PROFILE,"rb");
    fseek(fp,0,SEEK_END);
    flen=ftell(fp);
    b_profile=(char *)malloc(flen);
    if(b_profile==NULL){
        fclose(fp);
        printf("Alango VCP Can't find profile configuration.\n");
        return ;
    }
    if(fp==NULL){
        printf("Alango VCP Can't open profile configuration.\n");
        return ;
    }
    fseek(fp,0,SEEK_SET);
    fsize=fread(b_profile,1,flen,fp);
    if(fsize!=flen){
        printf("read file error , read len ==== %d , return size ===%d", flen, fsize);
        fclose(fp);
        return;
    }
    p=read_binary_profile(b_profile,0);
    printf("alango_vcp_init 111 \n");
    err = vcp_check_profile(p);
    printf("alango_vcp_init 222 \n");
    if (err.err){
         if (err.err == ERR_INVALID_CRC)
             printf("alango_vcp_init Profile error: Invalid CRC!");
         else
             printf("alango_vcp_init Profile error: vcp_errorv(err) \n");
    }
    smem = vcp_get_hook_size();
    mem = malloc(smem);
    printf("alango_vcp_init 333 \n");
        vcp_get_mem_size(p, reg, mem);
        printf("alango_vcp_init 444 \n");
    free(mem);

    input_frame[0] = malloc(FRAME_VCP*sizeof(short));    //  5ms 16K 16bit buffer
    input_frame[1] = malloc(FRAME_VCP*sizeof(short));    //  5ms 16K 16bit buffer
    input_frame[2] = malloc(FRAME_VCP*sizeof(short));    //  5ms 16K 16bit buffer
    input_frame[3] = malloc(FRAME_VCP*sizeof(short));    //  5ms 16K 16bit buffer
    spk[0] = malloc(FRAME_VCP*sizeof(short));    //  5ms 16K 16bit buffer
    spk[1] = malloc(FRAME_VCP*sizeof(short));    //  5ms 16K 16bit buffer
    for (int i = 0; i < NUM_MEM_REGIONS; i++){
        reg[i].mem = smr[i] = (void *)malloc(reg[i].size);
        printf("alango_vcp_init I need %d bytes of memory in memory region %d to work.\n", reg[i].size, i + 1);
    }
    err = vcp_init_debug(p, reg);
    if (err.err == ERR_NOT_ENOUGH_MEMORY)
    {
        printf("alango_vcp_init %d more bytes needed in region %d!\n", -reg[err.pid].size, err.pid);
    }
    else if (err.err == ERR_UNKNOWN)
    {
        printf("alango_vcp_init vcp_init_debug() returns UNKNOWN error\n!");
    }
    else if (err.err != ERR_NO_ERROR)
    {
        printf("alango_vcp_init vcp_init_debug() returns error __text_error[err.err], err.pid!\n");
    }
}



    vcp_profile_t * read_binary_profile(void *pmem, int allocate)
    {
       vcp_profile_t *prof;//base_profile();
       prof= malloc(sizeof(profile_tab));
    }
“隐式函数声明”意味着调用函数时,编译器看不到任何函数声明。由于C99标准,这在C中不再允许

显然,在面对这样一个函数调用时,编译器仍然试图从中提取一个旧的C90“隐式int”,这意味着一旦发现这个
p=my\u read\u binary\u profile(b\u profile,0)
,它会将函数视为声明为
int my\u read\u binary\u profile(int,int)
,并相应地生成机器代码,这显然是错误的

这导致了第二个错误,“隐式int”垃圾与正确的函数定义
vcp\u profile\u t*my\u read\u binary\u profile(void*pmem,int allocate)
不匹配,因此类型冲突

通过在文件顶部添加函数声明原型来解决此问题:

vcp_profile_t* my_read_binary_profile(void* pmem, int allocate);

只需在调用函数之前声明它,就像您应该经常做的那样。冲突类型错误是您忘记声明它的结果,因此它返回到一个默认类型,该默认类型与实际类型不同。只需复制函数原型,将其放在文件顶部,并以分号终止。这是打字错误吗?代码不包含
read\u binary\u profile
。这是否回答了您的问题?谢谢你的回复。在调用之前,我很想声明函数。但是我遇到了一些新的错误,比如架构arm64中未定义的符号:“\u vcp\u check\u profile”,引用自:AlangoBasic.o中的\u alango\u vcp\u init“\u vcp\u get\u hook\u size”,引用自:AlangoBasic.o中的\u alango\u vcp\u init”,引用自:AlangoBasic.o中的\u alango\u vcp\u init“\u vcp\u init\u debug”,引用自:AlangoBasic.oThanks中的\u alango\u vcp\u init以获取回复..声明错误消失后..但它显示了一些其他错误,如未定义符号“\u vcp\u check\u profile”未定义符号“\u vcp\u get\u hook\u size”未定义符号“\u vcp\u get\u mem size”未定义符号“_vcp_init_debug”@Aslam您的总体问题似乎是缺少头文件/库。实际上,我从客户端获得了此文件/库。我导入了所有文件和库…是否有其他方法解决此问题?@Aslam如果问题是从目标文件报告的,可能您只是试图从客户机链接原始对象文件,但是缺少了一些路径或其他什么。您可以尝试删除它们并创建一个干净的构建。否则,IDE找不到子目录等是很常见的。
vcp_profile_t* my_read_binary_profile(void* pmem, int allocate);