Pagina 2 di 4 primaprima 1 2 3 4 ultimoultimo
Visualizzazione dei risultati da 11 a 20 su 32

Discussione: C e mysql

  1. #11
    Hoinstallato mysql server 5.0 full.
    Ho installato devc++ per provare a impostare il compilatore con le librerire mysql.
    sono andato in STRUMENTI -> OPZIONI COMPILATORE -> CARTELLE e qui ho aggiunto :

    Nella voce FILE BINARI : percorso sql \bin
    LIBRERIE ercorso sql \lib
    INCLUDE C : percorso sql\include

    ho scritto poi un prog stupido per testare gli include:
    #include <mysql.h>
    int main(void)
    {
    return 0;
    }

    faccio complialare e mi appaiono milioni di errori nei file mysql.h/mysql_com.h

    Sono disperato...
    help

  2. #12
    bè, posta i primi 10
    ciao
    sergio

  3. #13
    Sono davvero tanti gli errori..
    e alcuni rindondanti:

    1 C:\Programmi\MySQL\MySQL Server 5.0\include\mysql.h:72, from C:\Documents and Settings\Administrator\Desktop\prova.c In file included from C:/Programmi/MySQL/MySQL Server 5.0/include/mysql.h:72, from C:\Documents and Settings\Administrator\Desktop\prova.c

    1 C:\Documents and Settings\Administrator\Desktop\prova.c from C:\Documents and Settings\Administrator\Desktop\prova.c

    183 C:\Programmi\MySQL\MySQL Server 5.0\include\mysql_com.h syntax error before "SOCKET"

    183 C:\Programmi\MySQL\MySQL Server 5.0\include\mysql_com.h [Warning] no semicolon at end of struct or union

    222 C:\Programmi\MySQL\MySQL Server 5.0\include\mysql_com.h syntax error before '}' token

    222 C:\Programmi\MySQL\MySQL Server 5.0\include\mysql_com.h [Warning] data definition has no type or storage class

    337 C:\Programmi\MySQL\MySQL Server 5.0\include\mysql_com.h syntax error before '*' token

    358 C:\Programmi\MySQL\MySQL Server 5.0\include\mysql_com.h syntax error before "s"

    1 C:\Documents and Settings\Administrator\Desktop\prova.c In file included from C:\Documents and Settings\Administrator\Desktop\prova.c

    257 C:\Programmi\MySQL\MySQL Server 5.0\include\mysql.h syntax error before "NET"

    282 C:\Programmi\MySQL\MySQL Server 5.0\include\mysql.h 'scramble' redeclared as different kind of symbol

    210 C:\Programmi\MySQL\MySQL Server 5.0\include\mysql_com.h previous declaration of 'last_error' was here

    468 C:\Programmi\MySQL\MySQL Server 5.0\include\mysql.h `mysql_set_local_infile_handler' declared as function returning a function


    sono tutti di questo tipo gli errori
    saranno un 100aio

    grazie ancora

  4. #14
    purtroppo uso linux, comunque guarda se le righe 179-222 di mysql_com.h corrispondono esattamente a queste
    codice:
    typedef struct st_net {
    #if !defined(CHECK_EMBEDDED_DIFFERENCES) || !defined(EMBEDDED_LIBRARY)
      Vio* vio;
      unsigned char *buff,*buff_end,*write_pos,*read_pos;
      my_socket fd;					/* For Perl DBI/dbd */
      unsigned long max_packet,max_packet_size;
      unsigned int pkt_nr,compress_pkt_nr;
      unsigned int write_timeout, read_timeout, retry_count;
      int fcntl;
      my_bool compress;
      /*
        The following variable is set if we are doing several queries in one
        command ( as in LOAD TABLE ... FROM MASTER ),
        and do not want to confuse the client with OK at the wrong time
      */
      unsigned long remain_in_buf,length, buf_length, where_b;
      unsigned int *return_status;
      unsigned char reading_or_writing;
      char save_char;
      my_bool no_send_ok;  /* For SPs and other things that do multiple stmts */
      my_bool no_send_eof; /* For SPs' first version read-only cursors */
      /*
        Set if OK packet is already sent, and we do not need to send error
        messages
      */
      my_bool no_send_error;
      /*
        Pointer to query object in query cache, do not equal NULL (0) for
        queries in cache that have not stored its results yet
      */
    #endif
      char last_error[MYSQL_ERRMSG_SIZE], sqlstate[SQLSTATE_LENGTH+1];
      unsigned int last_errno;
      unsigned char error;
    
      /*
        'query_cache_query' should be accessed only via query cache
        functions and methods to maintain proper locking.
      */
      gptr query_cache_query;
    
      my_bool report_error; /* We should report error (we have unreported error) */
      my_bool return_errno;
    } NET;

  5. #15
    è tutto scritto correttamente.
    Altre idee..

  6. #16
    Ho scoperto una cosa,
    Se il file lo compilo come file c++ , invece di c gli errori diminuiscono da infiniti diventano 6 :

    183 C:\Programmi\MySQL\MySQL Server 5.0\include\mysql_com.h `SOCKET' does not name a type

    360 C:\Programmi\MySQL\MySQL Server 5.0\include\mysql_com.h `SOCKET' was not declared in this scope

    360 C:\Programmi\MySQL\MySQL Server 5.0\include\mysql_com.h expected primary-expression before "const"

    360 C:\Programmi\MySQL\MySQL Server 5.0\include\mysql_com.h expected primary-expression before "unsigned"

    361 C:\Programmi\MySQL\MySQL Server 5.0\include\mysql_com.h expected primary-expression before "unsigned"

    361 C:\Programmi\MySQL\MySQL Server 5.0\include\mysql_com.h initializer expression list treated as compound expression


    Continuo a provare..
    Ciao ciao

  7. #17
    Ho risolto questo problema degli errori :

    non è stata definita la costante __LCC__ 1

    se a inizio file sorgente , prima degli #include... , si mette #define __LCC__ 1 , non vengono + dati errori.

    Ora ho solo provato a compilare un progstupido per vedere il funzionamento.
    ora testo le funzioni fornite dagli include e poi vi dico se funziona.

    Ciao ciao

  8. #18
    Ora quando provo ad utilizzare le funzioni degli include, mi da problemi con il linker:

    [Linker error] undefined reference to `mysql_connect'
    [Linker error] undefined reference to `mysql_select_db@8'
    [Linker error] undefined reference to `mysql_close@4'


    vi do acnhe i log di compilazione :


    Compilatore: Default compiler
    Esecuzione di gcc.exe...
    gcc.exe "C:\Documents and Settings\Administrator\Desktop\SenzaTitolo1.c" -o "C:\Documents and Settings\Administrator\Desktop\SenzaTitolo1.exe" -I"C:\Dev-Cpp\include" -I"C:\Programmi\MySQL\MySQL Server 5.0\include" -L"C:\Dev-Cpp\lib" -L"C:\Programmi\MySQL\MySQL Server 5.0\lib" -L"C:\Programmi\MySQL\MySQL Server 5.0\lib\opt"
    C:\DOCUME~1\ADMINI~1\IMPOST~1\Temp/ccs1aaaa.o(.text+0x58):SenzaTitolo1.c: undefined reference to `mysql_connect'
    C:\DOCUME~1\ADMINI~1\IMPOST~1\Temp/ccs1aaaa.o(.text+0x8b):SenzaTitolo1.c: undefined reference to `mysql_select_db@8'
    C:\DOCUME~1\ADMINI~1\IMPOST~1\Temp/ccs1aaaa.o(.text+0xc4):SenzaTitolo1.c: undefined reference to `mysql_close@4'
    collect2: ld returned 1 exit status

    Esecuzione terminata


    mm.. i problemi non finiscono mai VVoVe:

  9. #19
    Originariamente inviato da 1v4n

    Esecuzione di gcc.exe...
    gcc.exe "C:\Documents and Settings\Administrator\Desktop\SenzaTitolo1.c" -o "C:\Documents and Settings\Administrator\Desktop\SenzaTitolo1.exe" -I"C:\Dev-Cpp\include" -I"C:\Programmi\MySQL\MySQL Server 5.0\include" -L"C:\Dev-Cpp\lib" -L"C:\Programmi\MySQL\MySQL Server 5.0\lib" -L"C:\Programmi\MySQL\MySQL Server 5.0\lib\opt"
    non gli hai specificato la libreria mysqlclient.dll, con la opzione -L gli hai detto in che directory si trova la libreria con la opzione -l (elle minuscala) gli devi indicare quale è la libreria condivisa che vuoi linkare, devi mettere qualcosa del tipo -lmysqlclient .
    Probabilmente lo puoi fare anche dall'IDE devi guardare sulle opzioni del compilatore
    ciao
    sergio

  10. #20
    Sono Avvilito
    ho aggiunto l'opzione -l e in compilazione non da più problemi, peccato che se faccio compila & esegui , mi da un warning con attenzione file non compilato.. è la morte.

    Help

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2026 vBulletin Solutions, Inc. All rights reserved.