IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Bibliothèques Discussion :

bases de données en c++


Sujet :

Bibliothèques

  1. #1
    Membre à l'essai
    Profil pro
    Inscrit en
    Février 2006
    Messages
    33
    Détails du profil
    Informations personnelles :
    Localisation : Canada

    Informations forums :
    Inscription : Février 2006
    Messages : 33
    Points : 22
    Points
    22
    Par défaut bases de données en c++
    bonjour,

    je voulaiss faire une petite applications qui utilise une base de données. Je ne connais pas la syntaxe des bases de données en c++, j'ai donc cherché les fonctions sur internet. J'ai commencé en faisant quelques lignes de code juste pour tester une connections à une base de données. Voici le code:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
     
    #include	"mysql.h"
    #include<iostream>
    using namespace std;
    #include    <windows.h>
    #include	<stdio.h>
    #include	<string.h>
     
    void main&#40;char* url, char* user, char* pwd, char* bd&#41;
    &#123;
    	MYSQL *mySQL;
    	mySQL = mysql_init&#40;NULL&#41;;
     
    	if &#40;!mysql_real_connect&#40;mySQL, url, user, pwd, bd, 0, NULL, 0&#41;&#41; 
    	&#123;
    		cout<<"erreur de connexion"<<endl;
    	&#125; 
    	else 
    	&#123;
    		cout<<"connexion reussie"<<endl;
    	&#125;
    	mysql_close&#40;mySQL&#41;;
    &#125;
    j'ai installer mysql bien sûr.
    Quand je compile, j'ai cependant ces erreurs :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
     
    c&#58;\documents and settings\administrator\desktop\stéphanied\sql\mysql_com.h&#40;155&#41; &#58; error C2146&#58; syntax error &#58; missing ';' before identifier 'fd'
    c&#58;\documents and settings\administrator\desktop\stéphanied\sql\mysql_com.h&#40;155&#41; &#58; error C2501&#58; 'st_net&#58;&#58;SOCKET' &#58; missing storage-class or type specifiers
    c&#58;\documents and settings\administrator\desktop\stéphanied\sql\mysql_com.h&#40;155&#41; &#58; error C2501&#58; 'st_net&#58;&#58;fd' &#58; missing storage-class or type specifiers
    c&#58;\documents and settings\administrator\desktop\stéphanied\sql\mysql_com.h&#40;299&#41; &#58; error C2065&#58; 'SOCKET' &#58; undeclared identifier
    c&#58;\documents and settings\administrator\desktop\stéphanied\sql\mysql_com.h&#40;299&#41; &#58; error C2146&#58; syntax error &#58; missing '&#41;' before identifier 's'
    c&#58;\documents and settings\administrator\desktop\stéphanied\sql\mysql_com.h&#40;300&#41; &#58; error C2059&#58; syntax error &#58; '&#41;'
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;40&#41; &#58; error C2378&#58; 'SOCKET' &#58; redefinition; symbol cannot be overloaded with a typedef
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;56&#41; &#58; error C2146&#58; syntax error &#58; missing ';' before identifier 'fd_array'
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;56&#41; &#58; error C2501&#58; 'fd_set&#58;&#58;SOCKET' &#58; missing storage-class or type specifiers
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;56&#41; &#58; error C2501&#58; 'fd_set&#58;&#58;fd_array' &#58; missing storage-class or type specifiers
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;63&#41; &#58; error C3861&#58; 'SOCKET'&#58; identifier not found, even with argument-dependent lookup
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;63&#41; &#58; error C2059&#58; syntax error &#58; '&#41;'
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;744&#41; &#58; error C2143&#58; syntax error &#58; missing ';' before '__stdcall'
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;744&#41; &#58; error C2501&#58; 'SOCKET' &#58; missing storage-class or type specifiers
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;744&#41; &#58; error C2371&#58; 'SOCKET' &#58; redefinition; different basic types
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;745&#41; &#58; error C3861&#58; 'SOCKET'&#58; identifier not found, even with argument-dependent lookup
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;745&#41; &#58; error C2146&#58; syntax error &#58; missing '&#41;' before identifier 's'
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;745&#41; &#58; warning C4229&#58; anachronism used &#58; modifiers on data are ignored
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;745&#41; &#58; error C2501&#58; 'accept' &#58; missing storage-class or type specifiers
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;747&#41; &#58; error C2059&#58; syntax error &#58; '&#41;'
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;750&#41; &#58; error C3861&#58; 'SOCKET'&#58; identifier not found, even with argument-dependent lookup
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;750&#41; &#58; error C2146&#58; syntax error &#58; missing '&#41;' before identifier 's'
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;750&#41; &#58; warning C4229&#58; anachronism used &#58; modifiers on data are ignored
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;752&#41; &#58; error C2059&#58; syntax error &#58; '&#41;'
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;754&#41; &#58; error C3861&#58; 'SOCKET'&#58; identifier not found, even with argument-dependent lookup
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;754&#41; &#58; error C2146&#58; syntax error &#58; missing '&#41;' before identifier 's'
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;754&#41; &#58; warning C4229&#58; anachronism used &#58; modifiers on data are ignored
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;754&#41; &#58; error C2059&#58; syntax error &#58; '&#41;'
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;757&#41; &#58; error C3861&#58; 'SOCKET'&#58; identifier not found, even with argument-dependent lookup
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;757&#41; &#58; error C2146&#58; syntax error &#58; missing '&#41;' before identifier 's'
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;757&#41; &#58; warning C4229&#58; anachronism used &#58; modifiers on data are ignored
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;759&#41; &#58; error C2059&#58; syntax error &#58; '&#41;'
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;762&#41; &#58; error C3861&#58; 'SOCKET'&#58; identifier not found, even with argument-dependent lookup
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;762&#41; &#58; error C2146&#58; syntax error &#58; missing '&#41;' before identifier 's'
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;762&#41; &#58; warning C4229&#58; anachronism used &#58; modifiers on data are ignored
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;764&#41; &#58; error C2059&#58; syntax error &#58; '&#41;'
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;767&#41; &#58; error C3861&#58; 'SOCKET'&#58; identifier not found, even with argument-dependent lookup
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;767&#41; &#58; error C2146&#58; syntax error &#58; missing '&#41;' before identifier 's'
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;767&#41; &#58; warning C4229&#58; anachronism used &#58; modifiers on data are ignored
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;769&#41; &#58; error C2059&#58; syntax error &#58; '&#41;'
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;772&#41; &#58; error C3861&#58; 'SOCKET'&#58; identifier not found, even with argument-dependent lookup
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;772&#41; &#58; error C2146&#58; syntax error &#58; missing '&#41;' before identifier 's'
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;772&#41; &#58; warning C4229&#58; anachronism used &#58; modifiers on data are ignored
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;774&#41; &#58; error C2059&#58; syntax error &#58; '&#41;'
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;777&#41; &#58; error C3861&#58; 'SOCKET'&#58; identifier not found, even with argument-dependent lookup
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;777&#41; &#58; error C2146&#58; syntax error &#58; missing '&#41;' before identifier 's'
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;777&#41; &#58; warning C4229&#58; anachronism used &#58; modifiers on data are ignored
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;781&#41; &#58; error C2059&#58; syntax error &#58; '&#41;'
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;792&#41; &#58; error C3861&#58; 'SOCKET'&#58; identifier not found, even with argument-dependent lookup
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;792&#41; &#58; error C2146&#58; syntax error &#58; missing '&#41;' before identifier 's'
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;792&#41; &#58; warning C4229&#58; anachronism used &#58; modifiers on data are ignored
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;793&#41; &#58; error C2059&#58; syntax error &#58; '&#41;'
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;800&#41; &#58; error C3861&#58; 'SOCKET'&#58; identifier not found, even with argument-dependent lookup
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;800&#41; &#58; error C2146&#58; syntax error &#58; missing '&#41;' before identifier 's'
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;800&#41; &#58; warning C4229&#58; anachronism used &#58; modifiers on data are ignored
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;803&#41; &#58; error C2059&#58; syntax error &#58; '&#41;'
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;806&#41; &#58; error C3861&#58; 'SOCKET'&#58; identifier not found, even with argument-dependent lookup
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;806&#41; &#58; error C2146&#58; syntax error &#58; missing '&#41;' before identifier 's'
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;806&#41; &#58; warning C4229&#58; anachronism used &#58; modifiers on data are ignored
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;811&#41; &#58; error C2059&#58; syntax error &#58; '&#41;'
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;821&#41; &#58; error C3861&#58; 'SOCKET'&#58; identifier not found, even with argument-dependent lookup
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;821&#41; &#58; error C2146&#58; syntax error &#58; missing '&#41;' before identifier 's'
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;821&#41; &#58; warning C4229&#58; anachronism used &#58; modifiers on data are ignored
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;824&#41; &#58; error C2059&#58; syntax error &#58; '&#41;'
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;827&#41; &#58; error C3861&#58; 'SOCKET'&#58; identifier not found, even with argument-dependent lookup
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;827&#41; &#58; error C2146&#58; syntax error &#58; missing '&#41;' before identifier 's'
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;827&#41; &#58; warning C4229&#58; anachronism used &#58; modifiers on data are ignored
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;832&#41; &#58; error C2059&#58; syntax error &#58; '&#41;'
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;835&#41; &#58; error C3861&#58; 'SOCKET'&#58; identifier not found, even with argument-dependent lookup
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;835&#41; &#58; error C2146&#58; syntax error &#58; missing '&#41;' before identifier 's'
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;835&#41; &#58; warning C4229&#58; anachronism used &#58; modifiers on data are ignored
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;839&#41; &#58; error C2059&#58; syntax error &#58; '&#41;'
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;842&#41; &#58; error C3861&#58; 'SOCKET'&#58; identifier not found, even with argument-dependent lookup
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;842&#41; &#58; error C2146&#58; syntax error &#58; missing '&#41;' before identifier 's'
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;842&#41; &#58; warning C4229&#58; anachronism used &#58; modifiers on data are ignored
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;843&#41; &#58; error C2059&#58; syntax error &#58; '&#41;'
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;845&#41; &#58; error C2143&#58; syntax error &#58; missing ';' before '__stdcall'
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;845&#41; &#58; error C2501&#58; 'SOCKET' &#58; missing storage-class or type specifiers
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;845&#41; &#58; error C2371&#58; 'SOCKET' &#58; redefinition; different basic types
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;944&#41; &#58; error C3861&#58; 'SOCKET'&#58; identifier not found, even with argument-dependent lookup
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;944&#41; &#58; error C2146&#58; syntax error &#58; missing '&#41;' before identifier 's'
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;944&#41; &#58; warning C4229&#58; anachronism used &#58; modifiers on data are ignored
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;947&#41; &#58; error C2059&#58; syntax error &#58; '&#41;'
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;950&#41; &#58; error C3861&#58; 'SOCKET'&#58; identifier not found, even with argument-dependent lookup
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;950&#41; &#58; error C2146&#58; syntax error &#58; missing '&#41;' before identifier 's'
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;950&#41; &#58; warning C4229&#58; anachronism used &#58; modifiers on data are ignored
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;953&#41; &#58; error C2059&#58; syntax error &#58; '&#41;'
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;969&#41; &#58; error C3861&#58; 'SOCKET'&#58; identifier not found, even with argument-dependent lookup
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;969&#41; &#58; error C2146&#58; syntax error &#58; missing '&#41;' before identifier 'hSocket'
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;969&#41; &#58; warning C4229&#58; anachronism used &#58; modifiers on data are ignored
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;976&#41; &#58; error C2059&#58; syntax error &#58; '&#41;'
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;981&#41; &#58; error C3861&#58; 'SOCKET'&#58; identifier not found, even with argument-dependent lookup
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;981&#41; &#58; error C2146&#58; syntax error &#58; missing '&#41;' before identifier 'sListenSocket'
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;981&#41; &#58; warning C4229&#58; anachronism used &#58; modifiers on data are ignored
    c&#58;\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock.h&#40;989&#41; &#58; error C2059&#58; syntax error &#58; '&#41;'
    Est-ce quelqu'un a une idée sur mon erreur, car je ne la trouve pas...
    surtout que WinSock est livré avec Visual et mysql_com.h c'est celui que j'ai téléchargé...


    une idée ?


    merci d'avance pour vos réponses...


    ps : j"ai juste un fichier cpp où il y a uniquement ce code je n'ai pas d'autres fichier...

  2. #2
    Membre éprouvé Avatar de Caine
    Inscrit en
    Mai 2004
    Messages
    1 028
    Détails du profil
    Informations personnelles :
    Âge : 51

    Informations forums :
    Inscription : Mai 2004
    Messages : 1 028
    Points : 1 122
    Points
    1 122
    Par défaut
    Je pense qu'il s'agit de problème dans ton makefile ou tes options de projets.

    Le code de ton main est tout à fait normal, il devrait marché.

    Si tu retires du projet mysql_com.h, ça donne quoi?

  3. #3
    Membre à l'essai
    Profil pro
    Inscrit en
    Février 2006
    Messages
    33
    Détails du profil
    Informations personnelles :
    Localisation : Canada

    Informations forums :
    Inscription : Février 2006
    Messages : 33
    Points : 22
    Points
    22
    Par défaut
    Quand je le retire du projet il me dit;
    c:\documents and settings\administrator\desktop\stéphanied\sql\mysql.h(57) : fatal error C1083: Cannot open include file: 'mysql_com.h': No such file or directory

  4. #4
    Membre averti
    Avatar de bigquick
    Profil pro
    Inscrit en
    Août 2002
    Messages
    356
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2002
    Messages : 356
    Points : 353
    Points
    353
    Par défaut
    Salut,

    C'est étonnant puisque ces définitions appartiennent à MySQL:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    typedef int my_socket
    #define my_socket   SOCKET
     
    typedef struct st_net
    &#123;
        my_socket fd;  // qui est bien à la ligne 155 de mysql_com.h &#40;si on omet les 20 premieres lignes de commentaires&#41;
    &#125;
    As-tu bien ajouté le chemin vers les headers de MySQL à ton projet, ainsi que le chemin vers les .lib ?

    ( cf. mysql_com.h )
    And still we will be here, standing like statues ...

  5. #5
    Membre à l'essai
    Profil pro
    Inscrit en
    Février 2006
    Messages
    33
    Détails du profil
    Informations personnelles :
    Localisation : Canada

    Informations forums :
    Inscription : Février 2006
    Messages : 33
    Points : 22
    Points
    22
    Par défaut
    ben j'ai regarder dans le fichier mysql_com.h et pour le typedef strust st_net moi j'ai :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
     
    typedef struct st_net &#123;
    #if !defined&#40;CHECK_EMBEDDED_DIFFERENCES&#41; || !defined&#40;EMBEDDED_LIBRARY&#41;
      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 &#40; as in LOAD TABLE ... FROM MASTER &#41;,
        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;
      /*
        Pointer to query object in query cache, do not equal NULL &#40;0&#41; for
        queries in cache that have not stored its results yet
      */
    #endif
      char last_error&#91;MYSQL_ERRMSG_SIZE&#93;, sqlstate&#91;SQLSTATE_LENGTH+1&#93;;
      unsigned int last_errno;
      unsigned char error;
      gptr query_cache_query;
      my_bool report_error; /* We should report error &#40;we have unreported error&#41; */
      my_bool return_errno;
    &#125;
    et en faisant la recherche dans ce même fichier il n'a pas trouvé les lignes
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
     
    typedef int my_socket 
    #define my_socket   SOCKET
    et pour ajouté les liens vers les headders et les lib, c'est dans les propriétés ? il y a plusieurs catégories et je ne sais pas où les ajouter car je n'ai jamais travaillé sur visual .net c'est la premiere fois ( je suis stagiaire)

  6. #6
    Membre averti
    Avatar de bigquick
    Profil pro
    Inscrit en
    Août 2002
    Messages
    356
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2002
    Messages : 356
    Points : 353
    Points
    353
    Par défaut
    Citation Envoyé par hukom1
    et en faisant la recherche dans ce même fichier il n'a pas trouvé les lignes
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    typedef int my_socket 
    #define my_socket   SOCKET
    Ces 2 définitions sont faites respectivement dans mysql.h (ligne 52) et config-win.h (ligne 141).

    Sinon pour configurer les chemins additionels sous Visual .Net, il faut clicker droit sur ton projet, puis selectionner "properties". Ensuite:

    HEADER : C/C++ / General / Additional Include Directories
    LIB : Linker / General / Additional Library Directories

    Les chemins à ajouter sont surement détaillés dans un readme d'installation de MySQL, ou devinables facilement (MySQL\include ? MySQL\lib ?)


    ps: bien sûr ma structure st_net était un exemple, elle est plus complete C'était juste pour pointer le fait que my_socket fd; est déclaré dedans.
    And still we will be here, standing like statues ...

  7. #7
    Expert confirmé
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Décembre 2003
    Messages
    3 549
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Essonne (Île de France)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels

    Informations forums :
    Inscription : Décembre 2003
    Messages : 3 549
    Points : 4 625
    Points
    4 625
    Par défaut
    libmysql est une bibliothèque C.
    La bibliothèque C++ c'est libmysql++
    Boost ftw

  8. #8
    Membre averti
    Avatar de bigquick
    Profil pro
    Inscrit en
    Août 2002
    Messages
    356
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2002
    Messages : 356
    Points : 353
    Points
    353
    Par défaut
    Ah en effet ça serait un meilleur point de départ !
    And still we will be here, standing like statues ...

  9. #9
    Membre à l'essai
    Profil pro
    Inscrit en
    Février 2006
    Messages
    33
    Détails du profil
    Informations personnelles :
    Localisation : Canada

    Informations forums :
    Inscription : Février 2006
    Messages : 33
    Points : 22
    Points
    22
    Par défaut
    j'ai rajouter les deux chemins pour les include et les lib dans les propriétés de mon projet et également dans les options de visual , (tools - options - projects - VC++ directories puis library et includes) mais j'ai toujours autant d'erreurs
    ai-je oublié d'inclure un .h dans mon code ?

  10. #10
    Membre à l'essai
    Profil pro
    Inscrit en
    Février 2006
    Messages
    33
    Détails du profil
    Informations personnelles :
    Localisation : Canada

    Informations forums :
    Inscription : Février 2006
    Messages : 33
    Points : 22
    Points
    22
    Par défaut
    ok, je viens de télécharger mysql++ 2.0.7. J'ai dezipper et dans mon projet, j'ai rajouté les chemins vers lles lib.
    Dans mon code j'ai changer le #include mysql.h par mysql++.h maintenant j'ai l'erreur suivante dans le fichier defs.h :
    c:\documents and settings\administrator\desktop\stéphanied\sql\lib\defs.h(34) : fatal error C1083: Cannot open include file: 'mysql.h': No such file or directory

  11. #11
    Membre à l'essai
    Profil pro
    Inscrit en
    Février 2006
    Messages
    33
    Détails du profil
    Informations personnelles :
    Localisation : Canada

    Informations forums :
    Inscription : Février 2006
    Messages : 33
    Points : 22
    Points
    22
    Par défaut
    Merci pour vos réponses.

    Après de nombreuses manipulations (avec Cygwin) et commandes, et changer de nombreuses propriétés de mon projet, j'ai réussi à ne plus avoir d'erreurs...

    Je vais maintenant tester des fonctions qui manipulent les bases de donées, et étant encore que débutant je pense bientôt être obligé de revenir pour vous demander de l'aide...


    a bientot...

    bonne soiree

  12. #12
    Membre éprouvé Avatar de Caine
    Inscrit en
    Mai 2004
    Messages
    1 028
    Détails du profil
    Informations personnelles :
    Âge : 51

    Informations forums :
    Inscription : Mai 2004
    Messages : 1 028
    Points : 1 122
    Points
    1 122
    Par défaut
    Je ne comprends plus là! Tu travailles sous Cygwin ou sous Visual .Net?

    Si c'est sous Cygwin, c'est la version "linux" de mysql qu'il faut charger.

  13. #13
    Membre à l'essai
    Profil pro
    Inscrit en
    Février 2006
    Messages
    33
    Détails du profil
    Informations personnelles :
    Localisation : Canada

    Informations forums :
    Inscription : Février 2006
    Messages : 33
    Points : 22
    Points
    22
    Par défaut
    je travaille bien sous visual .net. c'est quand j'ai télécharger mysql, dans le readMe c'est dit qu'il faut cygwin j'ai pris le readme.vc

  14. #14
    Nouveau Candidat au Club
    Profil pro
    Inscrit en
    Juin 2003
    Messages
    1
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2003
    Messages : 1
    Points : 1
    Points
    1
    Par défaut
    Citation Envoyé par hukom1
    je travaille bien sous visual .net. c'est quand j'ai télécharger mysql, dans le readMe c'est dit qu'il faut cygwin j'ai pris le readme.vc
    J'ai les meme erreur, j'ai essayer d'installer Cygwin (jusque la tout c'est bien passer) et lorsque j'essaye d'installer mysql++ comme il est mit dans le Readme.vc je me tape un erreur que j'arrive pas trop a comprendre.

    Je fais bien le 'makemake vc' et lorsque je lance le 'make' je tombe sur une erreur :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    E&#58;\mysql++>make
    cd lib && make BIN_DIR=debug all example_setup
    make&#91;1&#93;&#58; Entering directory `/cygdrive/e/mysql++/lib'
    cl /ID&#58;\Program Files\MySQL\include /DMYSQLPP_MAKING_DLL /D_WINDLL /D_UNICODE /G
    6 /EHsc /nologo /c /MDd /Od /D_DEBUG /ZI /Zi /Fodebug\coldata.obj coldata.cpp
    make&#91;1&#93;&#58; cl&#58; Command not found
    make&#91;1&#93;&#58; *** &#91;coldata.obj&#93; Error 127
    make&#91;1&#93;&#58; Leaving directory `/cygdrive/e/mysql++/lib'
    make&#58; *** &#91;all&#93; Error 2
    Pour moi, c'est dans le makefile.vc, j'ai une ligne :

    Je pense que le probleme vient de la mais je ne sais pas quoi faire...

    hukom1, as tu eu quelquechose de similaire ???

    Ca fait 3 jours que j'essaye d'acceder a une bdd mysql en C++ et je commence a desesperrer...

    Va falloir que je remette au C++ serieusement.

  15. #15
    Membre à l'essai
    Profil pro
    Inscrit en
    Février 2006
    Messages
    33
    Détails du profil
    Informations personnelles :
    Localisation : Canada

    Informations forums :
    Inscription : Février 2006
    Messages : 33
    Points : 22
    Points
    22
    Par défaut
    non je n'ai pas eu ça. Au debut j'avait une erreur car il ne trouvait pas le make, mais en fait je me suis placé dans le bon dossier avant de retaper la commande. en fait lors de l'installation il n'avait pas tout pris par défaut j'ai dû retourner sur le site où on télécharge cygwin et choisir ce qu'on veut installer. là il faut bien cohcer le fichier make. Et apres quand j'ai refait toutes les manips, il a tout bien compiler dans l'invite de commande et m'a généré les dll nécéssaires. Apres dans les projet qui se servent de mysql il faut bien penser a changer à chaque fois les propriété du debug et release comme c'est indiqué dans le ReadMa.vc

    voila j'espere que tu pourras résoudre ton problème comme moi ...

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Problème Base de données et CRecordSet
    Par LE CHAKAL dans le forum MFC
    Réponses: 3
    Dernier message: 20/08/2002, 11h59
  2. connexion base de donné
    Par saidi dans le forum MFC
    Réponses: 3
    Dernier message: 07/08/2002, 22h22
  3. [Concept] Stabilité d'une base de donnée
    Par lassmust dans le forum Décisions SGBD
    Réponses: 3
    Dernier message: 03/07/2002, 16h16
  4. Bases de données
    Par dev dans le forum C++Builder
    Réponses: 4
    Dernier message: 01/07/2002, 22h55
  5. associer une base de données(access) a un dbgrid
    Par ange1708 dans le forum MFC
    Réponses: 3
    Dernier message: 11/06/2002, 12h18

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo