Torna indietro   Hardware Upgrade Forum > Software > Programmazione

Wind Tre 'accende' il 5G Standalone in Italia: si apre una nuova era basata sui servizi
Wind Tre 'accende' il 5G Standalone in Italia: si apre una nuova era basata sui servizi
Con la prima rete 5G Standalone attiva in Italia, WINDTRE compie un passo decisivo verso un modello di connettività intelligente che abilita scenari avanzati per imprese e pubbliche amministrazioni, trasformando la rete da infrastruttura a piattaforma per servizi a valore aggiunto
OPPO Find X9 Pro: il camera phone con teleobiettivo da 200MP e batteria da 7500 mAh
OPPO Find X9 Pro: il camera phone con teleobiettivo da 200MP e batteria da 7500 mAh
OPPO Find X9 Pro punta a diventare uno dei riferimenti assoluti nel segmento dei camera phone di fascia alta. Con un teleobiettivo Hasselblad da 200 MP, una batteria al silicio-carbonio da 7500 mAh e un display da 6,78 pollici con cornici ultra ridotte, il nuovo flagship non teme confronti con la concorrenza, e non solo nel comparto fotografico mobile. La dotazione tecnica include il processore MediaTek Dimensity 9500, certificazione IP69 e un sistema di ricarica rapida a 80W
DJI Romo, il robot aspirapolvere tutto trasparente
DJI Romo, il robot aspirapolvere tutto trasparente
Anche DJI entra nel panorama delle aziende che propongono una soluzione per la pulizia di casa, facendo leva sulla propria esperienza legata alla mappatura degli ambienti e all'evitamento di ostacoli maturata nel mondo dei droni. Romo è un robot preciso ed efficace, dal design decisamente originale e unico ma che richiede per questo un costo d'acquisto molto elevato
Tutti gli articoli Tutte le news

Vai al Forum
Rispondi
 
Strumenti
Old 24-10-2008, 18:01   #1
UnknownSoldier
Member
 
Iscritto dal: Aug 2008
Messaggi: 210
[C/MySQL] Non riesco a connettermi al database

Salve a tutti. Uso dev-c++ e ho creato un nuovo progetto C per connettermi al mio database mysql. Nelle opzioni del progetto, ho specificato nelle "Cartelle include", l'indirizzo: C:\mysql\include.

Questo il codice:

Codice:
#include <mysql.h>
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
  MYSQL *connection;
  MYSQL *res:
  MYSQL *row;
  
  char *host = "localhost";
  char *user = "root";
  char *pass = "";
  char *db = "mysql";
  
  connection = mysql_init (NULL);
  if (!mysql_real_connect (connection, host, user, pass, db, 0, NULL, 0))
  {
     printf ("%s", mysql_error (connection));
     exit (0);
  }
  
  if (mysql_query (connection, "CREATE TABLE IF NOT EXISTS ctest (id INT UNSIGNED NOT NULL auto_increment, value VARCHAR (20), PRIMARY KEY (id))"))
  {
     printf ("%s", mysql_error (connection));
     exit (0);
  }
  
  mysql_free_result (res);
  mysql_close (connection);
  
  system("PAUSE");	
  return 0;
}
Ma mi da vari errori quando tento di compilare, ecco il log:
Codice:
Compilatore: Default compiler
Building Makefile: "C:\Dev-Cpp\Makefile.win"
Esecuzione di  make...
make.exe -f "C:\Dev-Cpp\Makefile.win" all
gcc.exe -c main.c -o main.o -I"C:/Dev-Cpp/include"  -I"C:/mysql/include"  -I"C:/mysql/include"   

In file included from C:/mysql/include/mysql.h:72,
                 from main.c:1:
C:/mysql/include/mysql_com.h:183: error: syntax error before "SOCKET"
C:/mysql/include/mysql_com.h:183: warning: no semicolon at end of struct or union
C:/mysql/include/mysql_com.h:222: error: syntax error before '}' token
C:/mysql/include/mysql_com.h:222: warning: data definition has no type or storage class

C:/mysql/include/mysql_com.h:335: error: syntax error before '*' token
C:/mysql/include/mysql_com.h:336: error: syntax error before '*' token

C:/mysql/include/mysql_com.h:337: error: syntax error before '*' token
C:/mysql/include/mysql_com.h:338: error: syntax error before '*' token

C:/mysql/include/mysql_com.h:339: error: syntax error before '*' token
C:/mysql/include/mysql_com.h:340: error: syntax error before '*' token

C:/mysql/include/mysql_com.h:341: error: syntax error before '*' token
C:/mysql/include/mysql_com.h:342: error: syntax error before '*' token

C:/mysql/include/mysql_com.h:345: error: syntax error before '*' token
C:/mysql/include/mysql_com.h:346: error: syntax error before '*' token

C:/mysql/include/mysql_com.h:358: error: syntax error before "s"
In file included from main.c:1:
C:/mysql/include/mysql.h:257: error: syntax error before "NET"
C:/mysql/include/mysql.h:257: warning: no semicolon at end of struct or union
C:/mysql/include/mysql.h:282: error: 'scramble' redeclared as different kind of symbol
C:/mysql/include/mysql_com.h:426: error: previous declaration of 'scramble' was here

C:/mysql/include/mysql.h:282: error: 'scramble' redeclared as different kind of symbol
C:/mysql/include/mysql_com.h:426: error: previous declaration of 'scramble' was here
C:/mysql/include/mysql.h:311: error: syntax error before '}' token
C:/mysql/include/mysql.h:311: warning: data definition has no type or storage class
C:/mysql/include/mysql.h:319: error: syntax error before "MYSQL"
C:/mysql/include/mysql.h:319: warning: no semicolon at end of struct or union
C:/mysql/include/mysql.h:328: error: syntax error before '}' token
C:/mysql/include/mysql.h:328: warning: data definition has no type or storage class
C:/mysql/include/mysql.h:346: error: syntax error before "NET"
C:/mysql/include/mysql.h:346: warning: no semicolon at end of struct or union

C:/mysql/include/mysql.h:352: error: conflicting types for 'last_errno'
C:/mysql/include/mysql_com.h:211: error: previous declaration of 'last_errno' was here

C:/mysql/include/mysql.h:355: error: conflicting types for 'last_error'
C:/mysql/include/mysql_com.h:210: error: previous declaration of 'last_error' was here
C:/mysql/include/mysql.h:356: error: syntax error before '}' token
C:/mysql/include/mysql.h:356: warning: data definition has no type or storage class
C:/mysql/include/mysql.h:404: error: syntax error before '*' token
C:/mysql/include/mysql.h:405: error: syntax error before '*' token
C:/mysql/include/mysql.h:406: error: syntax error before '*' token
C:/mysql/include/mysql.h:407: error: syntax error before '*' token
C:/mysql/include/mysql.h:409: error: syntax error before '*' token
C:/mysql/include/mysql.h:410: error: syntax error before '*' token
C:/mysql/include/mysql.h:411: error: syntax error before '*' token

C:/mysql/include/mysql.h:790: error: syntax error before '*' token
C:/mysql/include/mysql.h:791: error: syntax error before '*' token
C:/mysql/include/mysql.h:794: error: syntax error before '*' token
C:/mysql/include/mysql.h:795: error: syntax error before '*' token

C:/mysql/include/mysql.h:796: error: syntax error before '*' token
C:/mysql/include/mysql.h:799: error: syntax error before '*' token
C:/mysql/include/mysql.h:802: error: syntax error before '*' token
C:/mysql/include/mysql.h:803: error: syntax error before '*' token

C:/mysql/include/mysql.h:804: error: syntax error before '*' token
C:/mysql/include/mysql.h:805: error: syntax error before '*' token
C:/mysql/include/mysql.h:806: error: syntax error before '*' token
C:/mysql/include/mysql.h:807: error: syntax error before '*' token

C:/mysql/include/mysql.h:811: error: syntax error before '*' token
C:/mysql/include/mysql.h:811: error: syntax error before '*' token
C:/mysql/include/mysql.h:811: warning: data definition has no type or storage class
C:/mysql/include/mysql.h:812: error: syntax error before '*' token
C:/mysql/include/mysql.h:812: error: syntax error before '*' token
C:/mysql/include/mysql.h:812: warning: data definition has no type or storage class
C:/mysql/include/mysql.h:813: error: syntax error before '*' token
C:/mysql/include/mysql.h:814: error: syntax error before '*' token
C:/mysql/include/mysql.h:815: error: syntax error before '*' token
C:/mysql/include/mysql.h:816: error: syntax error before '*' token
C:/mysql/include/mysql.h:818: error: syntax error before '*' token
C:/mysql/include/mysql.h:819: error: syntax error before '*' token
C:/mysql/include/mysql.h:820: error: syntax error before '*' token
C:/mysql/include/mysql.h:821: error: syntax error before '*' token
C:/mysql/include/mysql.h:822: error: syntax error before '*' token
C:/mysql/include/mysql.h:823: error: syntax error before '*' token
C:/mysql/include/mysql.h:825: error: syntax error before '*' token
C:/mysql/include/mysql.h:826: error: syntax error before '*' token
C:/mysql/include/mysql.h:827: error: syntax error before '*' token
C:/mysql/include/mysql.h:828: error: syntax error before '*' token
C:/mysql/include/mysql.h:829: error: syntax error before '*' token
C:/mysql/include/mysql.h:830: error: syntax error before '*' token
main.c: In function `main':
main.c:7: error: `connection' undeclared (first use in this function)
main.c:7: error: (Each undeclared identifier is reported only once
main.c:7: error: for each function it appears in.)
main.c:8: error: `res' undeclared (first use in this function)
main.c:8: error: syntax error before ':' token

make.exe: *** [main.o] Error 1

Esecuzione terminata
(ho accorciato un pò il log altrimenti non riuscivo a postare)
Qualche idea?
UnknownSoldier è offline   Rispondi citando il messaggio o parte di esso
Old 24-10-2008, 18:13   #2
british
Member
 
L'Avatar di british
 
Iscritto dal: Sep 2008
Città: Milano
Messaggi: 126
Quote:
Originariamente inviato da UnknownSoldier Guarda i messaggi
Codice:
 MYSQL *res:

la riga che ti ho quotato non dovrebbe terminare con punto e virgola? (semicolon)

ciao!

british
british è offline   Rispondi citando il messaggio o parte di esso
Old 24-10-2008, 21:20   #3
UnknownSoldier
Member
 
Iscritto dal: Aug 2008
Messaggi: 210
Quote:
Originariamente inviato da british Guarda i messaggi
la riga che ti ho quotato non dovrebbe terminare con punto e virgola? (semicolon)

ciao!

british
Sì ho corretto ma il punto non è questo...
UnknownSoldier è offline   Rispondi citando il messaggio o parte di esso
 Rispondi


Wind Tre 'accende' il 5G Standalone in Italia: si apre una nuova era basata sui servizi Wind Tre 'accende' il 5G Standalone in Italia: s...
OPPO Find X9 Pro: il camera phone con teleobiettivo da 200MP e batteria da 7500 mAh OPPO Find X9 Pro: il camera phone con teleobiett...
DJI Romo, il robot aspirapolvere tutto trasparente DJI Romo, il robot aspirapolvere tutto trasparen...
DJI Osmo Nano: la piccola fotocamera alla prova sul campo DJI Osmo Nano: la piccola fotocamera alla prova ...
FUJIFILM X-T30 III, la nuova mirrorless compatta FUJIFILM X-T30 III, la nuova mirrorless compatta
Addio console: Just Dance Now trasforma ...
Driver Radeon Adrenalin 25.10: perch&egr...
Oltre le GPU: NVIDIA annuncia NVQLink, ...
Samsung lancia il Team Galaxy Italia per...
Magic Leap: indistinguibili dai normali ...
Aruba Cloud: trasparenza sui costi e str...
Quando il cloud si blocca e resti al fre...
Integrare per competere, la sfida digita...
Leggenda del rally e modernità: S...
La Python Software Foundation rinuncia a...
Full HD e QLED, è in offerta un TV da 32...
Honda ha rilasciato un nuovo video sul p...
Resident Evil Requiem: arriva su Switch ...
Marshall Acton III in promo su Amazon in...
2 portatili che costano poco ma vanno be...
Chromium
GPU-Z
OCCT
LibreOffice Portable
Opera One Portable
Opera One 106
CCleaner Portable
CCleaner Standard
Cpu-Z
Driver NVIDIA GeForce 546.65 WHQL
SmartFTP
Trillian
Google Chrome Portable
Google Chrome 120
VirtualBox
Tutti gli articoli Tutte le news Tutti i download

Strumenti

Regole
Non Puoi aprire nuove discussioni
Non Puoi rispondere ai messaggi
Non Puoi allegare file
Non Puoi modificare i tuoi messaggi

Il codice vB è On
Le Faccine sono On
Il codice [IMG] è On
Il codice HTML è Off
Vai al Forum


Tutti gli orari sono GMT +1. Ora sono le: 21:50.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Served by www3v