小编Lol*_*lyW的帖子

错误:函数类型冲突,函数在头文件中声明

因此,我尝试使用makefile和头文件等编译一个多文件程序。即使我已经一百万次仔细检查了该类型,但我仍然得到了这个程序,并不断遇到相同的错误。救命!

错误:

search.c:11: error: conflicting types for 'search' search.h:1: note: previous declaration of 'search' was here

这是我的.h文件

int search(struct intnode** root, int lookingfor, int* counter);
Run Code Online (Sandbox Code Playgroud)

这是我的.c文件

#include "search.h"
#include "intnode.h"
#include <stdlib.h>
#include <stdio.h>

/*
Usage:
  search(root, value);
*/

int search(struct intnode** root, int lookingfor, int* counter) {

  /*COMPARE TO ROOT KEY*/
  /*IF EQUAL*/
  if(int_compare(lookingfor, (*root)->key) == 0) {
    printf("%d exists in tree", lookingfor);
    counter++;
    if ((*root)->R != NULL && (*root)->key == (*root)->R) {
      search((*root)->R, lookingfor, *counter);
    }
  }

  /*IF …
Run Code Online (Sandbox Code Playgroud)

c compiler-errors function

5
推荐指数
1
解决办法
4175
查看次数

标签 统计

c ×1

compiler-errors ×1

function ×1