why i get these errors here

This is a discussion on why i get these errors here within the C Programming forums, part of the General Programming Boards category; ---- 1>Deleting intermediate and output files for project 'ex6', configuration 'Debug|Win32' 1>Compiling... 1>ex6.c 1>c:\documents and settings\lun\my documents\visual studio 2005\projects\ex6\ex6\ex6.c(19) : ...

  1. #1
    Banned
    Join Date
    Oct 2008
    Posts
    1,535

    why i get these errors here

    ----
    1>Deleting intermediate and output files for project 'ex6', configuration 'Debug|Win32'
    1>Compiling...
    1>ex6.c
    1>c:\documents and settings\lun\my documents\visual studio 2005\projects\ex6\ex6\ex6.c(19) : error C2143: syntax error : missing ';' before '{'
    1>c:\documents and settings\lun\my documents\visual studio 2005\projects\ex6\ex6\ex6.c(81) : error C2143: syntax error : missing ';' before 'type'
    1>c:\documents and settings\lun\my documents\visual studio 2005\projects\ex6\ex6\ex6.c(83) : error C2065: 'j' : undeclared identifier
    1>c:\documents and settings\lun\my documents\visual studio 2005\projects\ex6\ex6\ex6.c(83) : error C2065: 'count' : undeclared identifier
    1>c:\documents and settings\lun\my documents\visual studio 2005\projects\ex6\ex6\ex6.c(83) : error C2065: 'i' : undeclared identifier
    1>c:\documents and settings\lun\my documents\visual studio 2005\projects\ex6\ex6\ex6.c(84) : error C2065: 'curr' : undeclared identifier
    1>c:\documents and settings\lun\my documents\visual studio 2005\projects\ex6\ex6\ex6.c(84) : error C2224: left of '.candidate' must have struct/union type
    1>c:\documents and settings\lun\my documents\visual studio 2005\projects\ex6\ex6\ex6.c(84) : error C2039: 'candidate' : is not a member of '_iobuf'
    1> c:\program files\microsoft visual studio 8\vc\include\stdio.h(59) : see declaration of '_iobuf'
    1>c:\documents and settings\lun\my documents\visual studio 2005\projects\ex6\ex6\ex6.c(85) : warning C4098: 'report' : 'void' function returning a value
    1>c:\documents and settings\lun\my documents\visual studio 2005\projects\ex6\ex6\ex6.c(86) : error C2224: left of '.type' must have struct/union type
    1>c:\documents and settings\lun\my documents\visual studio 2005\projects\ex6\ex6\ex6.c(86) : error C2039: 'type' : is not a member of '_iobuf'
    1> c:\program files\microsoft visual studio 8\vc\include\stdio.h(59) : see declaration of '_iobuf'
    1>c:\documents and settings\lun\my documents\visual studio 2005\projects\ex6\ex6\ex6.c(87) : warning C4098: 'report' : 'void' function returning a value
    1>c:\documents and settings\lun\my documents\visual studio 2005\projects\ex6\ex6\ex6.c(88) : error C2224: left of '.type' must have struct/union type
    1>c:\documents and settings\lun\my documents\visual studio 2005\projects\ex6\ex6\ex6.c(88) : error C2039: 'type' : is not a member of '_iobuf'
    1> c:\program files\microsoft visual studio 8\vc\include\stdio.h(59) : see declaration of '_iobuf'
    1>c:\documents and settings\\my documents\visual studio 2005\projects\ex6\ex6\ex6.c(90) : warning C4098: 'report' : 'void' function returning a value
    1>c:\documents and settings\my documents\visual studio 2005\projects\ex6\ex6\ex6.c(92) : warning C4098: 'report' : 'void' function returning a value
    1>Build log was saved at "file://c:\Documents and Settings\lun\My Documents\Visual Studio 2005\Projects\ex6\ex6\Debug\BuildLog.htm"
    1>ex6 - 12 error(s), 4 warning(s)
    ========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

    Code:
    #include <stdio.h>
    #include <string.h>
    #include <stdlib.h>
     
    
     
    typedef struct vote {
    	char name [30];
    	int id,type,candidate;
    } vote;
    void report(FILE* college[3], FILE* arr[10], char* canceled){
    // Fuction returns the minimal id
    int getMin(int eof[],vote [],int *);
    // Function checks a vote record correct
    int votecheck(vote ,vote [],int i);
    // Function reads the next record from "college" file
    int readFrom(FILE *,vote [],int);
    
    void  report(FILE *college[3], FILE *arr[10], char* canceled){
    	FILE *cancel;
    	vote currtable[3], // array for three current "college" records
    		votable[3],    // array for checking the records with the same "id"
    		current;	   // struct for the current "college" record	
    	int i,j,idmin,index,flag,eof[3];
    	if(!(cancel=fopen(canceled,"w"))) exit(1);
    	
    	for(i=0;i<3;i++)
    		eof[i]= readFrom(college[i],currtable,i);
    // main loop	
    	while(eof[0]!=EOF||eof[1]!=EOF||eof[2]!=EOF){
    		idmin=getMin(eof,currtable,&index);
    		for(i=flag=0;i<3;i++)
    			if(i!=index && eof[i]!=EOF && currtable[i].id==idmin)
    				flag=3;
    		if(flag){
    		fprintf(cancel,"%s%d%d\n",currtable[index].name,idmin,flag);
    			for(i=0;i<3;i++)
    				while(eof[i]!=EOF && currtable[i].id==idmin)
    				eof[i]=readFrom(college[i],currtable,i);
    			continue;
    		}
    //Filling struct table for the minimal id
    		votable[0]=currtable[index];
    		i=1;
    		while(eof[index]!=EOF && i<3){						eof[index]=fscanf(college[index],"%30[^\n]%9d%1d%1d%*c",
    current.name,&current.id,&current.type,&current.candidate);
    		if(current.id!=idmin){
    			for(j=0;j<i;j++)									fprintf(arr[votable[j].candidate],"%9d%d%d\n",
    idmin,index,votable[j].type);
    		currtable[index]=current;
    		break;
    		}
    		else{
    			flag=votecheck(current,votable,i);
    			if(flag){				fprintf(cancel,"%s%d%d\n",currtable[index].name,idmin,flag);
    			while(eof[index]!=EOF && currtable[index].id==idmin)
    			eof[index]=readFrom(college[index],currtable,index);
    			break;
    			}
    			else
    				votable[i++]=current;
    		}//else
    	}//while
    	if(i<3)  continue;
    		if(eof[index]!=EOF)
    		eof[index]=fscanf(college[index],"%30[^\n]%9d%1d%1d%*c",
    current.name,&current.id,&current.type,&current.candidate);
    		if(eof[index]==EOF ||current.id!=idmin ){
    			for(j=0;j<i;j++)
    				fprintf(arr[votable[j].candidate],"%9d%d%d\n",
    idmin,index,votable[j].type);		
    			currtable[index]=current;
    		}
    		else{			fprintf(cancel,"%s%d%d\n",votable[0].name,idmin,2);
    	while(eof[index]!=EOF && currtable[index].id==idmin)				eof[index]=readFrom(college[index],currtable,index);
    		}
    	}// main loop - while
    	fclose(cancel);
    }// report
    
    int votecheck(vote curr,vote arr[],int i){
    	int j,count;
    	for(j=count=0;j<i;j++){
    		if(curr.candidate==arr[j].candidate)
    			return 1;
    		if(curr.type==1 && arr[j].type==1)
    			return 2;
    		if(curr.type==2 && arr[j].type==2)
    			count++;
    		if(count>1)	return 2;
    	}
    	return 0;
    }
    
    int readFrom(FILE *coll,vote table[],int i){
    	return fscanf(coll,"%30[^\n]%9d%1d%1d%*c",table[i].name,
    				&table[i].id,&table[i].type,&table[i].candidate);
    }	
    
    int getMin(int eof[],vote table[],int *index){
    	int i,idmin;
    	for(i=0,idmin=999999999;i<3;i++)
    		if(eof[i]!=EOF && table[i].id<idmin){
    				idmin=table[i].id;
    				*index=i;
    		}
    	return idmin;			
    }

  2. #2
    Banned
    Join Date
    Oct 2008
    Posts
    1,535
    i fixed it a little
    now i get
    Rebuild All started: Project: ex6, Configuration: Debug Win32 ------
    1>Deleting intermediate and output files for project 'ex6', configuration 'Debug|Win32'
    1>Compiling...
    1>ex6.c
    1>c:\documents and settings\lun\my documents\visual studio 2005\projects\ex6\ex6\ex6.c(25) : warning C4996: 'fopen' was declared deprecated
    1> c:\program files\microsoft visual studio 8\vc\include\stdio.h(234) : see declaration of 'fopen'
    1> Message: 'This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'
    1>c:\documents and settings\lun\my documents\visual studio 2005\projects\ex6\ex6\ex6.c(46) : warning C4996: 'fscanf' was declared deprecated
    1> c:\program files\microsoft visual studio 8\vc\include\stdio.h(249) : see declaration of 'fscanf'
    1> Message: 'This function or variable may be unsafe. Consider using fscanf_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'
    1>c:\documents and settings\lun\my documents\visual studio 2005\projects\ex6\ex6\ex6.c(67) : warning C4996: 'fscanf' was declared deprecated
    1> c:\program files\microsoft visual studio 8\vc\include\stdio.h(249) : see declaration of 'fscanf'
    1> Message: 'This function or variable may be unsafe. Consider using fscanf_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'
    1>c:\documents and settings\lun\my documents\visual studio 2005\projects\ex6\ex6\ex6.c(97) : warning C4996: 'fscanf' was declared deprecated
    1> c:\program files\microsoft visual studio 8\vc\include\stdio.h(249) : see declaration of 'fscanf'
    1> Message: 'This function or variable may be unsafe. Consider using fscanf_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'
    1>Compiling manifest to resources...
    1>Linking...
    1>LINK : C:\Documents and Settings\lun\My Documents\Visual Studio 2005\Projects\ex6\Debug\ex6.exe not found or not built by the last incremental link; performing full link
    1>MSVCRTD.lib(crtexe.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup
    1>C:\Documents and Settings\lun\My Documents\Visual Studio 2005\Projects\ex6\Debug\ex6.exe : fatal error LNK1120: 1 unresolved externals
    1>Build log was saved at "file://c:\Documents and Settings\lun\My Documents\Visual Studio 2005\Projects\ex6\ex6\Debug\BuildLog.htm"
    1>ex6 - 2 error(s), 4 warning(s)
    ========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

    Code:
    #include <stdio.h>
    #include <string.h>
    #include <stdlib.h>
     
    
     
    typedef struct vote {
    	char name [30];
    	int id,type,candidate;
    } vote;
    void report(FILE* college[3], FILE* arr[10], char* canceled);
    // Fuction returns the minimal id
    int getMin(int eof[],vote [],int *);
    // Function checks a vote record correct
    int votecheck(vote ,vote [],int i);
    // Function reads the next record from "college" file
    int readFrom(FILE *,vote [],int);
    
    void  report(FILE *college[3], FILE *arr[10], char* canceled){
    	FILE *cancel;
    	vote currtable[3], // array for three current "college" records
    		votable[3],    // array for checking the records with the same "id"
    		current;	   // struct for the current "college" record	
    	int i,j,idmin,index,flag,eof[3];
    	if(!(cancel=fopen(canceled,"w"))) exit(1);
    	
    	for(i=0;i<3;i++)
    		eof[i]= readFrom(college[i],currtable,i);
    // main loop	
    	while(eof[0]!=EOF||eof[1]!=EOF||eof[2]!=EOF){
    		idmin=getMin(eof,currtable,&index);
    		for(i=flag=0;i<3;i++)
    			if(i!=index && eof[i]!=EOF && currtable[i].id==idmin)
    				flag=3;
    		if(flag){
    		fprintf(cancel,"%s%d%d\n",currtable[index].name,idmin,flag);
    			for(i=0;i<3;i++)
    				while(eof[i]!=EOF && currtable[i].id==idmin)
    				eof[i]=readFrom(college[i],currtable,i);
    			continue;
    		}
    //Filling struct table for the minimal id
    		votable[0]=currtable[index];
    		i=1;
    		while(eof[index]!=EOF && i<3){						eof[index]=fscanf(college[index],"%30[^\n]%9d%1d%1d%*c",
    current.name,&current.id,&current.type,&current.candidate);
    		if(current.id!=idmin){
    			for(j=0;j<i;j++)									fprintf(arr[votable[j].candidate],"%9d%d%d\n",
    idmin,index,votable[j].type);
    		currtable[index]=current;
    		break;
    		}
    		else{
    			flag=votecheck(current,votable,i);
    			if(flag){				fprintf(cancel,"%s%d%d\n",currtable[index].name,idmin,flag);
    			while(eof[index]!=EOF && currtable[index].id==idmin)
    			eof[index]=readFrom(college[index],currtable,index);
    			break;
    			}
    			else
    				votable[i++]=current;
    		}//else
    	}//while
    	if(i<3)  continue;
    		if(eof[index]!=EOF)
    		eof[index]=fscanf(college[index],"%30[^\n]%9d%1d%1d%*c",
    current.name,&current.id,&current.type,&current.candidate);
    		if(eof[index]==EOF ||current.id!=idmin ){
    			for(j=0;j<i;j++)
    				fprintf(arr[votable[j].candidate],"%9d%d%d\n",
    idmin,index,votable[j].type);		
    			currtable[index]=current;
    		}
    		else{			fprintf(cancel,"%s%d%d\n",votable[0].name,idmin,2);
    	while(eof[index]!=EOF && currtable[index].id==idmin)				eof[index]=readFrom(college[index],currtable,index);
    		}
    	}// main loop - while
    	fclose(cancel);
    }// report
    
    int votecheck(vote curr,vote arr[],int i){
    	int j,count;
    	for(j=count=0;j<i;j++){
    		if(curr.candidate==arr[j].candidate)
    			return 1;
    		if(curr.type==1 && arr[j].type==1)
    			return 2;
    		if(curr.type==2 && arr[j].type==2)
    			count++;
    		if(count>1)	return 2;
    	}
    	return 0;
    }
    
    int readFrom(FILE *coll,vote table[],int i){
    	return fscanf(coll,"%30[^\n]%9d%1d%1d%*c",table[i].name,
    				&table[i].id,&table[i].type,&table[i].candidate);
    }	
    
    int getMin(int eof[],vote table[],int *index){
    	int i,idmin;
    	for(i=0,idmin=999999999;i<3;i++)
    		if(eof[i]!=EOF && table[i].id<idmin){
    				idmin=table[i].id;
    				*index=i;
    		}
    	return idmin;			
    }

  3. #3
    Banned
    Join Date
    Oct 2008
    Posts
    1,535
    i know that its not intended
    this is because it the solution which being posted by my teacher

    and its not on his high priority that i would understand his solution

    so i am compiling it trying to see how it works

  4. #4
    Complete Beginner
    Join Date
    Feb 2009
    Posts
    312
    Your host environment is trying to tell you that it considers fopen()/fscanf() to be deprecated, suggesting fopen_s() and fscanf_s() instead. Looks like some Microsoft FUD to me. Change config options until it vanishes or get a decent compiler (almost any other).

    As for the actual error: you don't have a main() function, so the linker is not able to build a complete .EXE file.

    I've been able to infer this from the warning/error messages alone. Did you actually read them?

    Greets,
    Philip
    Last edited by Snafuist; 04-11-2009 at 11:27 AM.
    All things begin as source code.
    Source code begins with an empty file.
    -- Tao Te Chip

  5. #5
    Banned
    Join Date
    Oct 2008
    Posts
    1,535
    works thanks

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Ten Errors
    By AverageSoftware in forum Contests Board
    Replies: 0
    Last Post: 07-20-2007, 11:50 AM
  2. Unknown Errors in simple program
    By neandrake in forum C++ Programming
    Replies: 16
    Last Post: 04-06-2004, 03:57 PM
  3. Stupid compiler errors
    By ChrisEacrett in forum C++ Programming
    Replies: 9
    Last Post: 11-30-2003, 05:44 PM
  4. Help me with these errors... :-(
    By major_small in forum C++ Programming
    Replies: 6
    Last Post: 09-07-2003, 09:18 PM
  5. errors in class(urgent)
    By ayesha in forum C++ Programming
    Replies: 2
    Last Post: 11-10-2001, 06:51 PM

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