Close

Risultati da 1 a 5 di 5
  1. #1
    Pietra Miliare di Mac Peer L'avatar di iGodness
    Data Registrazione
    Feb 2006
    Località
    /Italia/Veneto/Mestre
    Messaggi
    1,338

    Non compila piu' in C?!?

     

    Tempo fa avevo installato XCode per compilare da terminale in C.

    Ultimamente pero', non riesco piu' a compilare. La stringa di comando e' sempre la stessa:

    gcc -o fileout DataParole.c

    Ma niente... Mi da sempre errore.
    Ho pensato "Forse sono i nuovi sorgenti che non sono corretti". Allora provo con quelli di un tempo -che funzionavano- ma anche con quelli... niente da fare.

    Forse sono un filo stressato ultimamente e canno qualcosa.. Sapreste dirmi soluzioni in merito?

  2. #2
    Quintessenza di Mac Peer L'avatar di TheCube
    Data Registrazione
    Jan 2005
    Località
    Milano
    Messaggi
    11,944
    Potresti fare almeno lo sforzo di riportare l'errore segnalato dal compilatore, o ritieni che si sia dotati di poteri paranormali?
    [B][FONT=Comic Sans MS][SIZE=4][COLOR=#0000ff]
    [/COLOR][/SIZE][/FONT][/B]

  3. #3
    Pietra Miliare di Mac Peer L'avatar di iGodness
    Data Registrazione
    Feb 2006
    Località
    /Italia/Veneto/Mestre
    Messaggi
    1,338
    Perdono.

    Eccoti accontentato. Direttamente dal terminale:

    DataParole.c: In function 'caso':
    DataParole.c:182: error: missing terminating " character
    DataParole.c:183: error: 'contrario' undeclared (first use in this function)
    DataParole.c:183: error: (Each undeclared identifier is reported only once
    DataParole.c:183: error: for each function it appears in.)
    DataParole.c:183: error: stray '\' in program
    DataParole.c:183: error: stray '\' in program
    DataParole.c:183: error: parse error before 'n'
    DataParole.c:183: error: missing terminating " character
    DataParole.c: At top level:
    DataParole.c:196: error: parse error before 'while'
    DataParole.c:199: error: missing terminating " character
    DataParole.c:200: error: missing terminating " character
    DataParole.c:202: error: conflicting types for 'pulisci'
    DataParole.c:35: error: previous declaration of 'pulisci' was here
    DataParole.c:202: warning: data definition has no type or storage class
    DataParole.c:203: error: parse error before 'return'
    DataParole.c:206: error: missing terminating " character
    DataParole.c:207: error: parse error before '.' token
    DataParole.c:207: error: stray '\' in program
    DataParole.c:207: error: stray '\' in program
    DataParole.c:207: error: missing terminating " character
    DataParole.c:217: warning: data definition has no type or storage class
    DataParole.c:219: error: parse error before 'if'
    DataParole.c:222: error: redefinition of 'control_flag'
    DataParole.c:217: error: previous definition of 'control_flag' was here
    DataParole.c:222: warning: data definition has no type or storage class
    DataParole.c:223: error: parse error before '}' token
    DataParole.c:227: error: missing terminating " character
    DataParole.c:228: error: missing terminating " character
    DataParole.c:233: error: 's' undeclared here (not in a function)
    DataParole.c:233: warning: data definition has no type or storage class
    DataParole.c:234: error: parse error before 'for'
    DataParole.c:239: error: conflicting types for 'pulisci'
    DataParole.c:35: error: previous declaration of 'pulisci' was here
    DataParole.c:239: warning: data definition has no type or storage class
    DataParole.c:240: error: parse error before 'return'
    DataParole.c:250: error: 'rem2' undeclared here (not in a function)
    DataParole.c:250: error: parse error before '.' token
    DataParole.c:252: error: parse error before string constant
    DataParole.c:252: error: conflicting types for 'printf'
    DataParole.c:252: note: a parameter list with an ellipsis can't match an empty parameter name list declaration
    DataParole.c:252: warning: data definition has no type or storage class
    DataParole.c:257: warning: parameter names (without types) in function declaration
    DataParole.c:257: error: conflicting types for 'gets'
    /usr/include/stdio.h:271: error: previous declaration of 'gets' was here
    DataParole.c:257: warning: data definition has no type or storage class
    DataParole.c:258: error: parse error before '++' token
    DataParole.c:263: warning: data definition has no type or storage class
    DataParole.c:264: error: parse error before 'for'
    DataParole.c:269: error: conflicting types for 'pulisci'
    DataParole.c:35: error: previous declaration of 'pulisci' was here
    DataParole.c:269: warning: data definition has no type or storage class
    DataParole.c:270: error: parse error before 'return'
    DataParole.c: In function 'save':
    DataParole.c:327: error: missing terminating " character
    DataParole.c:328: error: 'sul' undeclared (first use in this function)
    DataParole.c:328: error: parse error before 'file'
    DataParole.c:328: error: stray '\' in program
    DataParole.c:328: error: missing terminating " character
    DataParole.c:329: error: missing terminating " character
    DataParole.c:330: error: stray '\' in program
    DataParole.c:330: error: missing terminating " character
    DataParole.c: In function 'load_file':
    DataParole.c:354: error: missing terminating " character
    DataParole.c:355: error: 'y' undeclared (first use in this function)
    DataParole.c:355: error: 'n' undeclared (first use in this function)
    DataParole.c:355: error: stray '\' in program
    DataParole.c:355: error: missing terminating " character
    DataParole.c:357: error: parse error before 'do'
    DataParole.c: At top level:
    DataParole.c:360: error: parse error before 'while'
    DataParole.c:362: error: parse error before string constant
    DataParole.c:362: error: conflicting types for 'printf'
    DataParole.c:362: note: a parameter list with an ellipsis can't match an empty parameter name list declaration
    DataParole.c:362: warning: data definition has no type or storage class
    DataParole.c:367: error: missing terminating " character
    DataParole.c:368: error: missing terminating " character
    DataParole.c:370: error: parse error before string constant
    DataParole.c:370: error: conflicting types for 'printf'
    DataParole.c:370: note: a parameter list with an ellipsis can't match an empty parameter name list declaration
    DataParole.c:370: warning: data definition has no type or storage class
    DataParole.c:371: warning: parameter names (without types) in function declaration
    DataParole.c:371: error: conflicting types for 'gets'
    /usr/include/stdio.h:271: error: previous declaration of 'gets' was here
    DataParole.c:371: warning: data definition has no type or storage class
    DataParole.c:373: warning: parameter names (without types) in function declaration
    DataParole.c:373: error: conflicting types for 'strcat'
    DataParole.c:373: warning: data definition has no type or storage class
    DataParole.c:374: warning: parameter names (without types) in function declaration
    DataParole.c:374: error: conflicting types for 'strcat'
    DataParole.c:374: warning: data definition has no type or storage class
    DataParole.c:376: warning: data definition has no type or storage class
    DataParole.c:378: error: parse error before 'if'
    DataParole.c:380: error: redefinition of 'ok'
    DataParole.c:376: error: previous definition of 'ok' was here
    DataParole.c:380: warning: data definition has no type or storage class
    DataParole.c:381: error: parse error before '}' token
    DataParole.c:397: error: 't' undeclared here (not in a function)
    DataParole.c:397: error: parse error before '++' token
    DataParole.c:398: error: 'i' undeclared here (not in a function)
    DataParole.c:398: error: initializer element is not constant
    DataParole.c:398: warning: data definition has no type or storage class
    DataParole.c:399: error: parse error before 'if'
    DataParole.c:402: warning: parameter names (without types) in function declaration
    DataParole.c:402: warning: data definition has no type or storage class
    DataParole.c:403: error: parse error before '}' token
    DataParole.c:408: error: conflicting types for 'svuota'
    DataParole.c:36: error: previous declaration of 'svuota' was here
    DataParole.c:408: warning: data definition has no type or storage class
    DataParole.c:409: error: parse error before string constant
    DataParole.c:409: error: conflicting types for 'strcat'
    DataParole.c:409: warning: data definition has no type or storage class
    DataParole.c:410: error: conflicting types for 'pulisci'
    DataParole.c:35: error: previous declaration of 'pulisci' was here
    DataParole.c:410: warning: data definition has no type or storage class
    DataParole.c:411: error: parse error before 'break'

    Codice:
    /**********************************Librerie 
    usate********************************/
    #include
    #include
    #include
    
    /******************************Definizione 
    costanti******************************/
    #define MPAROLE 501
    #define MSLOT 6
    #define DIM 51
    #define offset 3
    
    /*********************************Strutture 
    usete********************************/
    typedef struct{
    char nome[DIM];
    int flag;
    }dataparole;
    
    typedef struct{
    dataparole parole[MPAROLE];
    int flag;
    }dataslot;
    
    /********************************Variabili 
    globali*******************************/
    dataslot slot[MSLOT];
    int ord_ok=0,cont_temp_records[MSLOT],cont_records[MSLOT],m_len=0;
    char *ext=".ceby",Percorso[50];
    
    /******************************Prototipi di 
    funzioni*****************************/
    void init_list(void), load_file(void);
    void add(void), pulisci(void), load_new(void);
    void view(void), caso(void), svuota(void);
    void help(void), save(int e), statistiche(void);
    int menu_select(void);
    int find_free(int num_slot);
    
    /*******************************Funzione 
    principale******************************/
    int main(void){
    int choice;
    
    pulisci();
    init_list();
    load_file();
    
    for(;;){
      choice=menu_select();
      switch(choice){
       case 1: add();
        break;
       case 2: view();
        break;
       case 3: caso();
        break;
       case 4: load_new();
        break;
       case 5: statistiche();
        break;
       case 6: save(0);
        break;
       case 7: help();
        break;
       case 8: save(1);
        break;
      }
    }
    return 0;
    }
    
    /*****************************Inizializza la 
    struttura***************************/
    void init_list(void){
    register int t,g,x;
    for(t=0; t8);
    
    printf("\n");
    return num;
    }
    
    /**************************Trova il primo record 
    vuoto***************************/
    int find_free(int num_slot){
    register int g;
    for(g=0; slot[num_slot].parole[g].nome[0] && gMSLOT-1);
    
    pos_free=find_free(num);
    
    if(pos_free==-1){
      printf("\n\n  Elenco completo\n\n\n");
      printf("\tPremi un tasto per continuare...");
      getchar();
      pulisci();
      return;
    }
    
    printf("\n\n");
    printf("  Ti trovi nel database numero %d\n", num);
    
    do{
      printf("  Posizione numero %d, immettere il nome: ", pos_free);
      gets(slot[num].parole[pos_free].nome);
      if(slot[num].parole[pos_free].nome[0]=='\0') control=0;
      else{
       control=1;
       cont_records[num]++;
       len=strlen(slot[num].parole[pos_free].nome);
       if(len>m_len) m_len=strlen(slot[num].parole[pos_free].nome);
       pos_free=find_free(num);
      }
    }while(control);
    
    pulisci();
    return;
    }
    
    /*******************************Randomizzatore***********************************/
    void caso(void){
    char ch[2],esc[2];
    int rem1=0,rem2=0,i=0,data[MSLOT];
    int esci=0,control_flag=0,cont_slot=0;
    register int s,u;
    
    pulisci();
    
    printf("\n  Inserisci 1 nei database da randomizzare, 0 in caso 
    contrario.\n\n");
    
    do{
      printf("  Database numero %d: ",i);
      gets(ch);
      data[i]=atoi(ch);
      if(data[i]==1){
       i++;
       cont_slot++;
      }else if(data[i]==0 && ch[0]=='0'){
       i++;
       esci++;
      }
    }while(i0){
    	 do{
          rem2=rand()%MSLOT;
    	 }while(!(data[rem2]) || slot[rem2].flag==1);
    	}
       }
    
      }while(control_flag);
    
      slot[rem2].parole[rem1].flag=1;
    
      printf("  %d) parola: %s\n", i,slot[rem2].parole[rem1].nome);
    
      //controllo
      //printf(" pos:%d slot:%d\n", rem1,rem2);
    
      gets(esc);
      i++;
    }while(esc[0]!='q');
    
    for(s=0; sacul_amd@hotmail.it\n");
    printf("  Descrizione: \n\n\n");
    
    printf("\n\n\n  Premi un tasto per continuare...");
    getchar();
    pulisci();
    return;
    }
    
    /**********************Salvare la struttura su file ed 
    uscire********************/
    void save(int e){
    FILE *fp;
    char NomeFile[50];
    int i,t,ok=0;
    
    pulisci();
    
    printf("\n\t\tRANDOMIZZATORE DI PAROLE CON DATABASE\n\n");
    
    do{
      if(Percorso[0]=='>'){
       printf("  Inserisci il percorso del file da salvare: ");
       gets(Percorso);
       printf("  Inserisci il nome del file senza esensione: ");
       gets(NomeFile);
       strcat(Percorso,NomeFile);
       strcat(Percorso,ext);
      }
    
      ok=0;
    
      if((fp=fopen(Percorso, "wb"))==NULL){
       printf("\n  Impossibile salvare il file.\n\n");
       ok=1;
      }
    }while(ok);
    
    pulisci();
    
    for(t=0; tm_len) m_len=strlen(slot[t].parole[i].nome);
         }
    
         fclose(fp);
    	}
       }while(ok);
       break;
      case 'n':
       printf("\n  Nessun file caricato\n\n");
       svuota();
       strcat(Percorso,">Nessun file caricato");
       pulisci();
       break;
    }
    return;
    }
    
    /**************************Funzione che svuota l'array 
    Percorso*****************/
    void svuota(){
    register int y;
    int len;
    len=strlen(Percorso);
    for(y=0; yMSLOT-1);
    
    printf("\n");
    i=0;
    t=0;
    r=0;
    
    do{
      for(; i<20*(r+1); i++){
       for(; t<3*(i+1); t++){
        if(t>MPAROLE-1) break;
        printf("  %d)%s", t,slot[num_data].parole[t].nome);
    
    	if(t<10){
    	 len=strlen(slot[num_data].parole[t].nome);
    	 len=(m_len+offset)-len;
    	}else if(t>=10 && t<100){
    	 len=strlen(slot[num_data].parole[t].nome);
    	 len=(m_len+offset-1)-len;
        }else if(t>=100){
    	 len=strlen(slot[num_data].parole[t].nome);
    	 len=(m_len+offset-2)-len;
    	}
    
    	for(p=0; pMPAROLE-1) break;
      }
      printf("\n  Premi un tasto per continuare la visualizzazione...\n");
      getchar();
      r++;
    }while(r<9);
    
    pulisci();
    
    do{
       printf("\n  Cosa vuoi fare?\n");
       printf("  1) Modifica una parola\n");
       printf("  2) Cancella una parola\n");
       printf("  3) Cancella piu' parole\n");
       printf("  4) Esci\n\n");
    
       do{
        printf("  Immetti la scelta: ");
        gets(ch);
        num=atoi(ch);
       }while(num<1 || num>4);
    
       printf("\n");
    
       switch(num){
        case 1:
         do{
          printf("  Inserisci il numero del record da modificare: ");
          gets(ch);
          num_rec=atoi(ch);
    	  /* atoi(ch) restituisce zero se ch Ë zero o Ë una lettera, se si verifica
    	  quest'ultimo caso, imposto la variabile num_rec al valore max+1 cosi
    	  son sicuro che non esce dal while.*/
          if(num_rec==0 && ch[0]!='0') num_rec=MPAROLE;
    	 }while(num_rec<0 || num_rec>MPAROLE-1);
    
         printf("  Nome vecchio: %s\n", slot[num_data].parole[num_rec].nome);
         printf("  Nome nuovo (vuoto per eliminarla): ");
         gets(slot[num_data].parole[num_rec].nome);
    	 if(slot[num_data].parole[num_rec].nome[0]=='\0') cont_records[num_data]--;
    	 num3=1;
    
    	 break;
    	case 2:
         do{
          printf("  Inserisci il numero del record da cancellare: ");
          gets(ch);
          num_rec=atoi(ch);
          if(num_rec==0 && ch[0]!='0') num_rec=MPAROLE;
    	 }while(num_rec<0 || num_rec>MPAROLE-1);
    
    	 printf("\n  Ho eliminato la seguente parola: %s\n", 
    slot[num_data].parole[num_rec].nome );
         slot[num_data].parole[num_rec].nome[0]='\0';
    	 cont_records[num_data]--;
    	 num3=1;
    
    	 break;
    	case 3:
         do{
          printf("  Inserisci il numero della prima parola: ");
          gets(ch);
          num_rec=atoi(ch);
    	  if(num_rec==0 && ch[0]!='0') num_rec=MPAROLE;
    
    	  printf("  Inserisci il numero dell'ultima parola: ");
          gets(ch);
          num_rec2=atoi(ch);
    	  if(num_rec2==0 && ch[0]!='0') num_rec2=MPAROLE;
    
    	 }while(num_rec<0 || num_rec>MPAROLE-1 || num_rec2<0 || num_rec2>MPAROLE-1 
    || num_rec>num_rec2);
    
    	 printf("\n");
         for(i=num_rec; i<=num_rec2; i++){
    		printf("  Ho eliminato la seguente parola: %s\n", 
    slot[num_data].parole[i].nome );
    		slot[num_data].parole[i].nome[0]='\0';
    		cont_records[num_data]--;
    	 }
    	 num3=1;
    
    	 break;
        case 4:
         num3=0;
         break;
      }
    
    }while(num3);
    
    pulisci();
    return;
    }
    
    void pulisci(void){
    #ifdef WIN32
      system("cls");		//for win
    #else
      system("clear");		//for linux e mac
    #endif
    }
    
    //End
    A quanto pare, sotto compilazione da Linux, pare fungere. Ma... Bho'.

  4. #4
    Quintessenza di Mac Peer L'avatar di TheCube
    Data Registrazione
    Jan 2005
    Località
    Milano
    Messaggi
    11,944
    gli header sono dove devono essere?
    a seguito di aggiornamento sono cambiate le opzioni di default del compilatore?

    Nella riga seguente l'"a capo" che si vede spero sia un errore di copia e incolla... altrimenti il problema è lì:
    Codice:
    printf("\n  Inserisci 1 nei database da randomizzare, 0 in caso 
    contrario.\n\n");
    Probabilmente c'è un fine riga che non dovrebbe esserci...
    [B][FONT=Comic Sans MS][SIZE=4][COLOR=#0000ff]
    [/COLOR][/SIZE][/FONT][/B]

  5. #5
    Pietra Miliare di Mac Peer L'avatar di iGodness
    Data Registrazione
    Feb 2006
    Località
    /Italia/Veneto/Mestre
    Messaggi
    1,338
    Non credo siano cambiate le opzioni di default del compilatore, ma nel caso fosse successo cosi', come faccio a controllare?

Discussioni Simili

  1. piu' ipod
    Di Romeo nel forum Mac - Hardware e Periferiche
    Risposte: 2
    Ultimo Messaggio: 07-07-07, 12:44
  2. amule non va' piu'
    Di kasichi nel forum p2p su Macintosh e Video Download
    Risposte: 1
    Ultimo Messaggio: 03-12-06, 21:58
  3. aMULE non va' piu'
    Di kasichi nel forum p2p su Macintosh e Video Download
    Risposte: 5
    Ultimo Messaggio: 02-12-06, 11:37
  4. NON S'ACCENDE PIU'!!!!!!!!!
    Di mauda nel forum Mac Help
    Risposte: 22
    Ultimo Messaggio: 06-07-06, 13:28
  5. amule non va piu'?!
    Di agnes nel forum p2p su Macintosh e Video Download
    Risposte: 12
    Ultimo Messaggio: 29-03-06, 12:46

Permessi di Scrittura

  • Tu non puoi inviare nuove discussioni
  • Tu non puoi inviare risposte
  • Tu non puoi inviare allegati
  • Tu non puoi modificare i tuoi messaggi
  •