Torna indietro   Hardware Upgrade Forum > Software > Programmazione

Recensione Samsung Galaxy Tab S12 Ultra: non chiamatelo tablet... è molto di più
Recensione Samsung Galaxy Tab S12 Ultra: non chiamatelo tablet... è molto di più
Abbiamo provato Samsung Galaxy Tab S12 Ultra nella versione 12 GB + 256 GB con tastiera, e il risultato è un tablet che in questa configurazione si comporta come un notebook con la fluidità tipica di Android. Spessore di 5,1 mm, display Dynamic AMOLED 2X da 14,6 pollici, MediaTek Dimensity 9500 e un software senza incertezze compongono un prodotto di vertice, con prezzi da 1.539 euro, frenato solo da un'autonomia nella parte bassa del confronto
Hyundai IONIQ 5 N, l'elettrica che finge di essere termica (e ci riesce da paura)
Hyundai IONIQ 5 N, l'elettrica che finge di essere termica (e ci riesce da paura)
Abbiamo provato per dieci giorni la Hyundai IONIQ 5 N, con 650 CV, 770 Nm e uno 0-100 km/h in 3,4 secondi. Il suo punto forte è N e-Shift, che simula un cambio a otto rapporti con suoni da motore termico e perfino un bang supersonico
CES Unveiled Milan, l'IA diventa tecnologia fondativa e il commercio torna centrale
CES Unveiled Milan, l'IA diventa tecnologia fondativa e il commercio torna centrale
La prima tappa italiana della Road to CES porta a Milano i vertici della Consumer Technology Association, con una nuova griglia di lettura dei trend tecnologici e una posizione netta su dazi e regolamentazione dell'IA
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


Recensione Samsung Galaxy Tab S12 Ultra: non chiamatelo tablet... è molto di più Recensione Samsung Galaxy Tab S12 Ultra: non chi...
Hyundai IONIQ 5 N, l'elettrica che finge di essere termica (e ci riesce da paura) Hyundai IONIQ 5 N, l'elettrica che finge di esse...
CES Unveiled Milan, l'IA diventa tecnologia fondativa e il commercio torna centrale CES Unveiled Milan, l'IA diventa tecnologia fond...
 Recensione OPPO Find X10 Pro Max: un top di gamma completo con tre fotocamere da 200MP Recensione OPPO Find X10 Pro Max: un top di gam...
WoW Forever provato: il MMORPG che la community chiedeva da anni è arrivato WoW Forever provato: il MMORPG che la community ...
Microsoft ha avviato un programma di usc...
Oracle lancia Fusion Claw: gli agenti di...
Oracle e Astrazeneca insieme per lo svil...
Anthropic e la quotazione: cosa emerge d...
Condanna milionaria per il sessantottenn...
HONOR Robot Phone a Movieland: abbiamo g...
Google Messaggi introduce la Protezione ...
Vera Rubin, NVIDIA aggiorna le specifich...
Google Health 5.11 amplia il rilevamento...
Legacy Games chiude dopo quasi 30 anni: ...
iPhone Duo avvia le automazioni quando l...
Tomb Raider: Legacy of Atlantis, rivelat...
Instagram arriva su Apple TV con un'app ...
Meta lancia un'offerta azionaria da 35 m...
L'Italia sfida i big dei semiconduttori:...
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: 01:35.


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