Torna indietro   Hardware Upgrade Forum > Software > Programmazione

Corsair Vanguard Air 99 Wireless: non si era mai vista una tastiera gaming così professionale
Corsair Vanguard Air 99 Wireless: non si era mai vista una tastiera gaming così professionale
Nelle ultime settimane abbiamo provato la Corsair Vanguard Air 99 Wireless, una tastiera tecnicamente da gaming, ma che in realtà offre un ampio ventaglio di possibilità anche al di fuori delle sessioni di gioco. Flessibilità e funzionalità sono le parole d'ordine di una periferica che si rivolge a chi cerca un prodotto capace di adattarsi a ogni esigenza e ogni piattaforma
Ecovacs DEEBOT T90 PRO OMNI: ora il rullo di lavaggio è ampio
Ecovacs DEEBOT T90 PRO OMNI: ora il rullo di lavaggio è ampio
DEEBOT T90 PRO OMNI abbina un sistema di aspirazione basato su tecnologia BLAST ad un rullo di lavaggio dei pavimenti dalla larghezza elevata, capace di trattare al meglio le superfici di casa minimizzando i tempi di lavoro. Un robot completo che riesce anche ad essere sottile e garantire automazione ed efficienza nelle operazioni di pulizia di casa
Recensione Samsung Galaxy S26 Ultra: finalmente qualcosa di nuovo
Recensione Samsung Galaxy S26 Ultra: finalmente qualcosa di nuovo
Per diversi giorni il Galaxy S26 Ultra di Samsung è stato il nostro compagno di vita. Oltre alle conferme del colosso coreano come la qualità del display e una suite AI senza rivali, arriva il Privacy Display, un unicum nel mondo smartphone. Ci sono ancora alcuni gap che non sono riusciti a colmare lato batteria e fotocamera, seppur con alcuni miglioramenti.
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


Corsair Vanguard Air 99 Wireless: non si era mai vista una tastiera gaming così professionale Corsair Vanguard Air 99 Wireless: non si era mai...
Ecovacs DEEBOT T90 PRO OMNI: ora il rullo di lavaggio è ampio Ecovacs DEEBOT T90 PRO OMNI: ora il rullo di lav...
Recensione Samsung Galaxy S26 Ultra: finalmente qualcosa di nuovo Recensione Samsung Galaxy S26 Ultra: finalmente ...
Diablo II Resurrected: il nuovo DLC Reign of the Warlock Diablo II Resurrected: il nuovo DLC Reign of the...
Deep Tech Revolution: così Area Science Park apre i laboratori alle startup Deep Tech Revolution: così Area Science P...
NVIDIA RTX PRO 4500 Server Edition: la s...
Core Ultra 200 HX Plus: Intel mette il t...
Starfield arriva su PS5: data ufficiale,...
iPad Air 13" (M4) scende di prezzo: -100...
Oracle annuncia Java 26 con il Java Veri...
OPPO Find N6 è ufficiale: sottile...
Influencer sotto controllo Agcom: arriva...
Scontro in OpenAI sul ChatGPT per adulti...
Apple Watch Series 11 a 349€ e altri int...
Starlink rinnova i piani residenziali in...
POCO X8 Pro e Pro Max ufficiali: potenza...
Jensen Huang propone i token come nuovo ...
Realme 16 Pro e 16 Pro+ tra i più...
Dall'enciclopedia all'algoritmo: Encyclo...
Il CEO di Epic Games Tim Sweeney ha comp...
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: 20:38.


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