C 通过'的arg2;listFind';来自不兼容的指针类型
我的函数有一些问题,不知道如何解决这个问题,这是我的代码:C 通过'的arg2;listFind';来自不兼容的指针类型,c,eclipse,warnings,compiler-warnings,C,Eclipse,Warnings,Compiler Warnings,我的函数有一些问题,不知道如何解决这个问题,这是我的代码: ListResult result=listFind(currentLines, compareBasicLines, &linePrototype); <-here problem COMPARE_NUMBER_字符串(第1行,第2行)在另一个文件中定义 #define COMPARE_NUMBER_STRINGS(var1, var2) \
ListResult result=listFind(currentLines, compareBasicLines, &linePrototype); <-here problem
COMPARE_NUMBER_字符串(第1行,第2行)代码>在另一个文件中定义
#define COMPARE_NUMBER_STRINGS(var1, var2) \
if(var1 == NULL || var2 == NULL){ \
return 0; \
} \
return strcmp(var1->strNumber, var2->strNumber);
提前感谢大家
这就是我所拥有的,我的家庭作业是关于ADT的,所以我不知道我在列表中找到了什么
/**
* Searches the list for an element fitting the criteria starting from the
* current element.
* Note that you need to call listGetFirst if you wish to search from the start
* of the list. The search starts from the current element.
* @param list
* The list to search in
* @param compare
* Comparison function to decide if an element in the last is equal to the
* target elemnt. This function should return 0 for equal elements
* @param target
* A target element to compare with each element in the list.
* @return
* LIST_NULL_ARGUMENT if list or compare are NULL
* LIST_INVALID_CURRENT if the current pointer of the list is in invalid state
* LIST_NO_SUCH_ELEMENT if no element was found from the current element until
* the end of the list
* LIST_SUCCESS an element was found and the current pointer of the list is now
* set to this element
*
*/
ListResult listFind(List list, CompareListElements compare, ListElement target);
还有一个定义
typedef int (*CompareListElements)(ListElement, ListElement);
typedef void* ListElement;
listFind()
的第二个参数的类型为int(*)(ptrLine,ptrLine)
。这显然不同于listFind()
声明中第二个参数的类型
如果看不到listFind()
的定义,就很难说应该做些什么来修复它。抱歉,但您需要更具体一些。有什么问题?它不能编译吗?链接失败?错误消息是什么?从不兼容指针传递“listFind”的arg2
typedef int (*CompareListElements)(ListElement, ListElement);
typedef void* ListElement;