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
....}

Recommended Answers

All 8 Replies

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

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. :(((

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

prototype:

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

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

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

> 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.

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.