Carloz Posted January 8, 2008 at 09:04 PM Report Share #158736 Posted January 8, 2008 at 09:04 PM Boas Hoje quando abri o linux e compilei o meu programa (programa final que tenho estado a trabalhar, e a ultima vez que o executei correu perfeitamente) aquilo começou para ali a mostrar erros que nunca mais acabavam...e nao faço ideia do que se passa. Testei no Windows e acontece o mesmo. Entretanto fui removendo bocados de código e encontrei um bocado que se remover já não dá erros...isto no linux, porque no windows continua a dar. :S Erros de compilação: final.c:126: error: expected declaration specifiers or "..." before string constant final.c:126: error: expected declaration specifiers or "..." before "nt" final.c:126: warning: data definition has no type or storage class final.c:126: error: conflicting types for "printf" final.c:126: note: a parameter list with an ellipsis can"t match an empty parameter name list declaration final.c:129: error: expected declaration specifiers or "..." before string constant final.c:129: warning: data definition has no type or storage class final.c:129: error: conflicting types for "printf" final.c:129: note: a parameter list with an ellipsis can"t match an empty parameter name list declaration final.c:132: error: expected identifier or "(" before "for" final.c:132: error: expected "=", ",", ";", "asm" or "__attribute__" before "<" token final.c:132: error: expected "=", ",", ";", "asm" or "__attribute__" before "++" token final.c:137: error: expected declaration specifiers or "..." before string constant final.c:137: error: expected declaration specifiers or "..." before "n" final.c:137: error: expected declaration specifiers or "..." before "nt" final.c:137: warning: data definition has no type or storage class final.c:137: error: conflicting types for "printf" final.c:137: note: a parameter list with an ellipsis can"t match an empty parameter name list declaration final.c:139: warning: data definition has no type or storage class final.c:140: warning: data definition has no type or storage class final.c:140: error: conflicting types for "_pause" final.c:44: error: previous definition of "_pause" was here final.c:141: warning: data definition has no type or storage class final.c:141: error: conflicting types for "_clean" final.c:49: error: previous definition of "_clean" was here final.c:144: warning: data definition has no type or storage class final.c:144: error: conflicting types for "menu" final.c:54: error: previous definition of "menu" was here final.c:145: error: expected identifier or "(" before "}" token Linha que removo no linux...penso que não tem problema nenhum (ciclo while): int nt=0; //NUMERO DE ELEMENTOS TOTAIS while (fgetc(fp)!=EOF) //LÊ UM CARACTER nt++; } printf("Foram detectados %d elementos no ficheiro.\n", nt); Não faço ideia do que se possa estar a passar, principalmente porque o programa corria perfeitamente bem :S omg... Cumps "Rejoice not against me, O mine enemy: when I fall, I shall arise; when I sit in darkness, the LORD shall be a light unto me." - Micah 7:8 (KJV) Link to comment Share on other sites More sharing options...
Guest id194 Posted January 8, 2008 at 09:19 PM Report Share #158739 Posted January 8, 2008 at 09:19 PM O fgetc() é uma função que devolve algo, experimenta fazer: int c; while ((c = fgetc(fp)) != EOF) Pode ser que resolva... Link to comment Share on other sites More sharing options...
Rui Carlos Posted January 8, 2008 at 09:30 PM Report Share #158741 Posted January 8, 2008 at 09:30 PM É capaz de ser melhor colocar aqui o ficheiro todo. Rui Carlos Gonçalves Link to comment Share on other sites More sharing options...
Carloz Posted January 8, 2008 at 09:35 PM Author Report Share #158745 Posted January 8, 2008 at 09:35 PM O fgetc() é uma função que devolve algo, experimenta fazer: int c; while ((c = fgetc(fp)) != EOF) Pode ser que resolva... Também não...mas eu acho que não é disso porque no windows continua a dar erros...e dantes corria bem. É capaz de ser melhor colocar aqui o ficheiro todo. CÓDIGO RETIRADO! Eu não percebo é como é que isto fica assim de um dia para o outro :S Cumps "Rejoice not against me, O mine enemy: when I fall, I shall arise; when I sit in darkness, the LORD shall be a light unto me." - Micah 7:8 (KJV) Link to comment Share on other sites More sharing options...
Rui Carlos Posted January 8, 2008 at 09:41 PM Report Share #158747 Posted January 8, 2008 at 09:41 PM Afinal o erro estava à vista no código que mostraste... Tens uma chaveta a mais a seguir ao while. Rui Carlos Gonçalves Link to comment Share on other sites More sharing options...
Carloz Posted January 8, 2008 at 09:59 PM Author Report Share #158755 Posted January 8, 2008 at 09:59 PM Afinal o erro estava à vista no código que mostraste... Tens uma chaveta a mais a seguir ao while. Bem visto...não percebo é porquê tanto erro por causa de uma chaveta. :\ E também não sei como é que a chaveta desapareceu...só se apaguei sem querer ou assim. Btw...no windows continua com uns erros esquisitas mas não me vou preocupar...isto é para linux. É que eu tou a emular o fedora no VMware Player e quando abri isto e vi tanto erro pensei que já tivesse formatado o texto, ou se tivessem perdido dados ou assim...principalmente porque da ultima vez que mexi no código estava tudo certinho. Anyway...muito obrigado aos dois 🙂 "Rejoice not against me, O mine enemy: when I fall, I shall arise; when I sit in darkness, the LORD shall be a light unto me." - Micah 7:8 (KJV) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now