error C2371 : redefinition; different basic types

This is a discussion on error C2371 : redefinition; different basic types within the C Programming forums, part of the General Programming Boards category; Hi im writing a program for a user calender operation i keep getting dis error and i cant figure how ...

  1. #1
    Seb
    Seb is offline
    Registered User
    Join Date
    Apr 2009
    Posts
    7

    error C2371 : redefinition; different basic types

    Hi
    im writing a program for a user calender operation
    i keep getting dis error and i cant figure how to fix it

    Code:
    error C2371: 'day_of_the_week_month_of_year' : redefinition; different basic types
    here where the prolem is
    Code:
    void view_events(struct evnt* head)
    
    {
    	struct evnt* nod;
    	for(nod=head; nod!=NULL; nod=nod->next)
    	{
    		day_of_the_week_month_of_year(nod->day,nod->month,nod->year);
    		printf("\nStart Time: %d\nEnd Time:%d\nEvent description:%s\n",nod->begin_time,nod->end_time,nod->event_details);
    		printf("\n\n");
    	}			
    }
    and this is the function
    Code:
    void day_of_the_week_month_of_year(int day,int month,int year)
    {
    	int a,m,y,date=0;
    	checking_date(day,month,year);
    	a=((14-month)/12);
    	y=(year-a);
    	m=(month+(12*a)-2);
    	date=((date+y+(y/4)-(y/100)+(y/400)+(31*m/12))%7);
    	if(date==0)
    		printf("\nSunday");
    	if(date==1)
    		printf("\nonday");
    	if(date==2)
    		printf("\nTuesday");
    	if(date==3)
    		printf("\nWednesday");
    	if(date==4)
    		printf("\nThursday");
    	if(date==5)
    		printf("\nFriday");
    	if(date==6)
    		printf("\nSaturday");
    		printf(" %d ",day);
    	if(month==1)
    		printf("January");
    	if(month==2)
    		printf("Febuary");
    	if(month==3)
    		printf("March");
    	if(month==4)
    		printf("April");
    	if(month==5)
    		printf("May");
    	if(month==6)
    		printf("June");
    	if(month==7)
    		printf("July");
    	if(month==8)
    		printf("August");
    	if(month==9)
    		printf("September");
    	if(month==10)
    		printf("October");
    	if(month==11)
    		printf("November");
    	if(month==12)
    		printf("December");
    		printf(" %d",year);
    }
    doesnt any one know how to fix dis error
    thanks

  2. #2
    DESTINY BEN10's Avatar
    Join Date
    Jul 2008
    Location
    in front of my computer
    Posts
    804
    although i'm not familiar with structures, what i see is while calling
    day_of_the_week_month_of_year(nod->day,nod->month,nod->year);
    the arguments doesn't match the parameters in the definition of "day_of_the_week_month_of_year"
    correct me if i'm wrong.

  3. #3
    Seb
    Seb is offline
    Registered User
    Join Date
    Apr 2009
    Posts
    7
    u r right bt the arugments are integers and the parameters r also integers
    so really it should work
    Last edited by Seb; 04-21-2009 at 08:22 AM.

  4. #4
    DESTINY BEN10's Avatar
    Join Date
    Jul 2008
    Location
    in front of my computer
    Posts
    804
    Quote Originally Posted by Seb View Post
    u r right bt the arugments are integers and the parameters r also integers
    so really it should work
    what i think is that the arguments are not integers they are of the type specified by the structure(as structure is a user defined data type).

  5. #5
    Registered User
    Join Date
    Oct 2008
    Location
    TX
    Posts
    2,047
    It's possible you may have another definition of that function elsewhere, in another source file perhaps.

  6. #6
    Seb
    Seb is offline
    Registered User
    Join Date
    Apr 2009
    Posts
    7
    well the structure i de fined like dis
    Code:
    struct evnt
    {
    	int day, month,year,begin_time,end_time;
    	char *event_details;
    	struct evnt *next;
    };

  7. #7
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by Seb View Post
    well the structure i de fined like dis
    Would it be hard for you to use full English words, for example, are you in some way disabled, so that typing th is much more difficult than the letter d? If so, I'd try to add that to your signature, so that you do not repeatedly get told to spell correctly. If you are not in any way disabled, please try your best at writing full, normally spelled, English words. Using "text-speak" is fine when you only have 160 characters to get your message across. It is simply annoying when we have a limit of several kilobytes, and you are only typing two lines anyways.

    A very likely scenario for your problem is that your compiler sees the function call without a prototype function declaration, and assumes [as the standard says] that your function returns an integer. It then finds the function declared with a void return type - which isn't what the compiler expected. However, this is speculation, as we haven't got ALL of your code, and thus can't really say what the compiler actually sees when compiling your code.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Error: redefinition of typedef xxxx
    By Rocha in forum C Programming
    Replies: 2
    Last Post: 11-24-2008, 08:19 AM
  2. Replies: 10
    Last Post: 11-22-2007, 11:13 PM
  3. Extending basic data types.
    By nempo in forum C++ Programming
    Replies: 23
    Last Post: 09-25-2007, 03:28 PM
  4. Visual Basic Adodc Problem
    By rahat in forum Windows Programming
    Replies: 1
    Last Post: 01-20-2002, 05:55 AM
  5. Visual Basic
    By nsk in forum C++ Programming
    Replies: 1
    Last Post: 11-23-2001, 06:36 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21