0

I'm trying to make a program,it's almost done... but i'm stuck on an error message that I get. I would appreciate any help.

The error message:

error: conflicting types for ‘findEntry’
note: previous implicit declaration of ‘findEntry’...LINE 15

I get it for this code:

catalogPointer findEntry(catalogPointer head, char names[])   //ERROR HERE
{
        catalogPointer p = head;
        while ( (p != NULL ) && ( ( strcmp(p->short_name, names) != 0) || (strcmp(p->surname,names)!=0) ) )
        {        p = p->next;
	}
        return p;
}
typedef struct catalog				
{
        char short_name[50];                    
        char surname[50];                       
        signed int amount;                     
        char description[1000];             	
	
	struct catalogue *next;

}catalog,*catalogPointer;			

catalogPointer current;
catalogPointer head = NULL;
char name[50];

int main() 
{....
catalogPointer find=findEntryToSearch(head,name);    // LINE 15
....}

Edited by Wizablue: n/a

3
Contributors
8
Replies
10
Views
6 Years
Discussion Span
Last Post by Wizablue
0

Some old compilers will look at findEntryToSearch() and findEntry() as the same function since only the first eight chars are distinctive, ignoring the rest.

Edited by Aia: n/a

0

Some old compilers will look at findEntryToSearch() and findEntry() as the same function since only the first eight chars are distinctive, ignoring the rest.

I checked it...the error remains. :(((

0

Post more code. The compiler thinks you have defined findEntry in another way before it errors.
What's the prototype of findEntry?

0

prototype:

catalogPointer findEntry(catalogPointer head, char last[]);
0

prototype:

catalogPointer findEntry(catalogPointer head, char last[]);

Yes, you only have thirty minutes to edit your post. It is alright adding more code in another post.

typedef struct catalog				
{
        char short_name[50];                    
        char surname[50];                       
        signed int amount;                     
        char description[1000];             	
	
	struct catalogue *next;

}catalog,*catalogPointer;

The highlighted part cannot be. It is either typedef struct catalog {} or typedef struct {} catalog; And since I am here, I'll save you from another bug. Inside the structure it should be struct catalog *next , instead of struct catalogue *next

Edited by Aia: n/a

0

Thanx Aia! That's right!
What about the error message? I still cant find what's wrong!

Edited by Wizablue: n/a

1

> note: previous implicit declaration of ‘findEntry’...LINE 15

The error message means that by the moment the compiler sees the use of the function, it didn't see neither its prototype nor definition. In such situation the compiler must guess how it should be prototyped, and usually it guesses wrong (it will presume that the function returns int).

Put the prototype somewhere above main(), and the error would go away.

0

nezachem by the time you posted,i was putting the prototypes! hehe!
thanxxxx anyway! ! !

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.