why its not compiling..

This is a discussion on why its not compiling.. within the C Programming forums, part of the General Programming Boards category; c(22) : error C2143: syntax error : missing ';' before 'type' 1>c:\documents and settings\lun\my documents\visual studio 2005\projects\ex6\ex6\ex6.c(25) : error C2143: ...

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

    why its not compiling..

    c(22) : error C2143: syntax error : missing ';' before 'type'
    1>c:\documents and settings\lun\my documents\visual studio 2005\projects\ex6\ex6\ex6.c(25) : error C2143: syntax error : missing ';' before 'type'
    1>c:\documents and settings\lun\my documents\visual studio 2005\projects\ex6\ex6\ex6.c(26) : error C2143: syntax error : missing ';' before 'type'
    1>c:\documents and settings\lun\my documents\visual studio 2005\projects\ex6\ex6\ex6.c(27) : error C2065: 'eof' : undeclared identifier
    1>c:\documents and settings\lun\my documents\visual studio 2005\projects\ex6\ex6\ex6.c(27) : error C2065: 'company' : undeclared identifier
    1>c:\documents and settings\lun\my documents\visual studio 2005\projects\ex6\ex6\ex6.c(27) : warning C4047: 'function' : 'const char *' differs in levels of indirection from 'int'
    1>c:\documents and settings\lun\my documents\visual studio 2005\projects\ex6\ex6\ex6.c(27) : warning C4024: 'scanf' : different types for formal and actual parameter 1
    1>c:\documents and settings\lun\my documents\visual studio 2005\projects\ex6\ex6\ex6.c(27) : error C2065: 'date' : undeclared identifier
    1>c:\documents and settings\lun\my documents\visual studio 2005\projects\ex6\ex6\ex6.c(27) : error C2065: 'name' : undeclared identifier
    1>c:\documents and settings\lun\my documents\visual studio 2005\projects\ex6\ex6\ex6.c(27) : error C2065: 'id' : undeclared identifier
    1>c:\documents and settings\lun\my documents\visual studio 2005\projects\ex6\ex6\ex6.c(27) : error C2065: 'rank' : undeclared identifier
    1>c:\documents and settings\lun\my documents\visual studio 2005\projects\ex6\ex6\ex6.c(27) : error C2065: 'post' : undeclared identifier
    1>c:\documents and settings\lun\my documents\visual studio 2005\projects\ex6\ex6\ex6.c(31) : error C2059: syntax error : 'return'
    1>c:\documents and settings\lun\my documents\visual studio 2005\projects\ex6\ex6\ex6.c(32) : error C2059: syntax error : '}'
    Code:
    #include <stdio.h>
    #include <string.h>
    #include <stdlib.h>
     
    
     
    void service(FILE* company,FILE* duty[9],char *done,char *clarif);
    int main ()
    {
    FILE* c[2];
    FILE* th;
     
    c[0]=fopen("c:\\post1.txt","r");//vote files ,each file represents the votes from a college
    c[1]=fopen("c:\\comp1.txt","r");
    th=fopen("c:\\comp1.txt","w");
     
    
    fclose(c[0]);
    fclose(c[1]);
    fclose(th);
    
    void service(FILE* company,FILE* duty[9],char *done,char *clarif)
    {
      char date[8],name[20],id[7],rank[5];
      int post;
      int eof;
      eof=scanf(company,"%8s,%20s,%7s,%5s,%d",date,name,id,rank,&post);
    }
    
    
    	return 0;
    }

  2. #2
    Banned
    Join Date
    Oct 2008
    Posts
    1,535
    i solved one error
    still i have
    c(13) : 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(14) : 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(15) : 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(22) : error C2143: syntax error : missing ';' before 'type'
    1>c:\documents and settings\lun\my documents\visual studio 2005\projects\ex6\ex6\ex6.c(25) : error C2143: syntax error : missing ';' before 'type'
    1>c:\documents and settings\lun\my documents\visual studio 2005\projects\ex6\ex6\ex6.c(26) : error C2143: syntax error : missing ';' before 'type'
    1>c:\documents and settings\lun\my documents\visual studio 2005\projects\ex6\ex6\ex6.c(27) : error C2065: 'eof' : undeclared identifier
    1>c:\documents and settings\lun\my documents\visual studio 2005\projects\ex6\ex6\ex6.c(27) : error C2065: 'company' : undeclared identifier
    1>c:\documents and settings\lun\my documents\visual studio 2005\projects\ex6\ex6\ex6.c(27) : warning C4047: 'function' : 'FILE *' differs in levels of indirection from 'int'
    1>c:\documents and settings\lun\my documents\visual studio 2005\projects\ex6\ex6\ex6.c(27) : warning C4024: 'fscanf' : different types for formal and actual parameter 1
    1>c:\documents and settings\lun\my documents\visual studio 2005\projects\ex6\ex6\ex6.c(27) : error C2065: 'date' : undeclared identifier
    1>c:\documents and settings\lun\my documents\visual studio 2005\projects\ex6\ex6\ex6.c(27) : error C2065: 'name' : undeclared identifier
    1>c:\documents and settings\lun\my documents\visual studio 2005\projects\ex6\ex6\ex6.c(27) : error C2065: 'id' : undeclared identifier
    1>c:\documents and settings\lun\my documents\visual studio 2005\projects\ex6\ex6\ex6.c(27) : error C2065: 'rank' : undeclared identifier
    1>c:\documents and settings\lun\my documents\visual studio 2005\projects\ex6\ex6\ex6.c(27) : error C2065: 'post' : undeclared identifier

    Code:
    #include <stdio.h>
    #include <string.h>
    #include <stdlib.h>
     
    
     
    void service(FILE* company,FILE* duty[9],char *done,char *clarif);
    int main ()
    {
    FILE* c[2];
    FILE* th;
     
    c[0]=fopen("c:\\post1.txt","r");//vote files ,each file represents the votes from a college
    c[1]=fopen("c:\\comp1.txt","r");
    th=fopen("c:\\comp1.txt","w");
     
    
    fclose(c[0]);
    fclose(c[1]);
    fclose(th);
    
    void service(FILE* company,FILE* duty[9],char *done,char *clarif)
    {
      char date[8],name[20],id[7],rank[5];
      int post;
      int eof;
      eof=fscanf(company,"%8s,%20s,%7s,%5s,%d",date,name,id,rank,&post);
     
    
    
    	return 0;
    }
    Last edited by transgalactic2; 04-15-2009 at 07:11 AM.

  3. #3
    Registered User
    Join Date
    Mar 2009
    Posts
    20
    you declare a function inside your main program!!!!

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

  5. #5
    DESTINY BEN10's Avatar
    Join Date
    Jul 2008
    Location
    in front of my computer
    Posts
    804
    Quote Originally Posted by xmariux View Post
    you declare a function inside your main program!!!!
    you can declare any function inside other but can't define it.

  6. #6
    Registered User
    Join Date
    Mar 2009
    Posts
    20
    oops sorry for my english definition is the right not declaration

  7. #7
    Registered User
    Join Date
    May 2008
    Location
    Australia
    Posts
    230
    :O You have 1,400 posts and you couldn't figure that out? :P You must ask a lot of questions.
    Last edited by pobri19; 04-15-2009 at 09:11 AM.
    Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Newbie Compiling Problem
    By Deronius in forum C++ Programming
    Replies: 3
    Last Post: 06-15-2008, 12:23 PM
  2. Problem compiling files that store functions
    By tiachopvutru in forum C++ Programming
    Replies: 10
    Last Post: 05-30-2008, 06:42 PM
  3. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 03:39 PM
  4. Compiling in Unix vs Visual C++
    By stimpyzu in forum C++ Programming
    Replies: 2
    Last Post: 09-30-2002, 07:41 AM
  5. Compiling syntax
    By Jez_Master in forum C++ Programming
    Replies: 3
    Last Post: 04-01-2002, 09:46 PM

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