Questo sito utilizza cookies solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi l'informativa sui cookies.
Salve mi chiamo maurizio, vorrei creare un gioco di ruolo in 2d online e ho appena installato le librerie di mysql++ e allegro (Le quali sò usare discretamente), però quando vado a compilare unsemplice programmino di prova nel quale l'utente muove uno sprite e le coordinate vengono salvate nel database mysql mi da i seguenti errori
(5 C:\Dev-Cpp\include\c++\3.4.2\backward\iostream.h:31, from C:\Documents and Settings\Standard\Desktop\2004\prova.cpp In file included from C:/Dev-Cpp/include/c++/3.4.2/backward/iostream.h:31, from C:\Documents and Settings\Standard\Desktop\2004\prova.cpp
5 C:\Documents and Settings\Standard\Desktop\2004\prova.cpp from C:\Documents and Settings\Standard\Desktop\2004\prova.cpp
32:2 C:\Dev-Cpp\include\c++\3.4.2\backward\backward_warning.h #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <iostream> instead of the deprecated header <iostream.h>. To disable this warning use -Wno-deprecated.
6 C:\Dev-Cpp\include\windows.h:52, from C:\Documents and Settings\Standard\Desktop\2004\prova.cpp In file included from C:/Dev-Cpp/include/windows.h:52, from C:\Documents and Settings\Standard\Desktop\2004\prova.cpp
6 C:\Documents and Settings\Standard\Desktop\2004\prova.cpp from C:\Documents and Settings\Standard\Desktop\2004\prova.cpp
void ins(int x, int y){
MYSQL *sock;
sock = mysql_init(0);
//Nel caso in cui l'inizializzazione non sia andata a buon fine restuituisce un mex di errore
if (!sock) {
/* cout << "Errore durante l'inizializzazione dell'oggetto MYSQL " << endl << mysql_error(sock) << endl;
system("PAUSE");
return ;*/
}
char *host = "localhost"; //Hostname
char *user = "root"; //user
char *pass = ""; //password
char *db = "demo"; //database
/*
Nel caso in cui la connessione non è andata a buon fine
termino il programma
*/
if (!mysql_real_connect(sock, host, user, pass, db, 0, NULL, 0)){
/*cout << "Errore durante la connessione MYSQL " << endl << mysql_error(sock) << endl;
system("PAUSE");*/
return;
}
char sql[255];
sprintf(sql,"INSERT INTO coo VALUES (%d,%d)",x,y);
mysql_query(sock,sql);
if (mysql_affected_rows(sock) != 1) {
/* cout << "Errore durante l'esecuzione della query " << endl << mysql_error(sock) << endl;
system("PAUSE");*/
return ;
}
mysql_close(sock);
}
Se compilati a parte non danno nessun errore.
Potreste aiutarmi ho cercato anche nel sito di allegro.cc ma non dice nulla a riguardo e ho cercato anche su google ma non ho trovato nulla...
Grazie in anticipo..
Ultima modifica effettuata da maury il 28/07/2009 alle 1:20
ho provato ma non è successo nulla.
Comunque mi sono dimenticato di dire che come compilatore uso dev-cpp ver. 4.9.9.2 e non ho mai riscontrato errori nell'usare #include<iostream> invece di #include<iostream.h>.
Comunque mi sono dimenticato di dire che come compilatore uso dev-cpp ver. 4.9.9.2 e non ho mai riscontrato errori nell'usare #include<iostream> invece di #include<iostream.h>.
iostream.h e' il modo obsoleto di indicare gli include C++ (e nei messaggi che avevi c'era questa indicazione, l'hai letta?) ... quindi comincia a modificare queste linee e poi parliamo del resto ... se non ti fidi, come leggi in firma, ignora questo messaggio ...
void ins(int x, int y){
MYSQL *sock;
sock = mysql_init(0);
//Nel caso in cui l'inizializzazione non sia andata a buon fine restuituisce un mex di errore
if (!sock) {
/* cout << "Errore durante l'inizializzazione dell'oggetto MYSQL " << endl << mysql_error(sock) << endl;
system("PAUSE");
return ;*/
}
char *host = "localhost"; //Hostname
char *user = "root"; //user
char *pass = ""; //password
char *db = "demo"; //database
/*
Nel caso in cui la connessione non è andata a buon fine
termino il programma
*/
if (!mysql_real_connect(sock, host, user, pass, db, 0, NULL, 0)){
/*cout << "Errore durante la connessione MYSQL " << endl << mysql_error(sock) << endl;
system("PAUSE");*/
return;
}
char sql[255];
sprintf(sql,"INSERT INTO coo VALUES (%d,%d)",x,y);
mysql_query(sock,sql);
if (mysql_affected_rows(sock) != 1) {
/* cout << "Errore durante l'esecuzione della query " << endl << mysql_error(sock) << endl;
system("PAUSE");*/
return ;
}
mysql_close(sock);
}
mi da questi errori:
\Documents and Settings\Standard\Desktop\2004\prova.cpp C:\Documents and Settings\Standard\Desktop\2004\C windows: No such file or directory.
\Documents and Settings\Standard\Desktop\2004\prova.cpp C:\Documents and Settings\Standard\Desktop\2004\C mysql/mysql: No such file or directory.
1 C:\Dev-Cpp\include\c++\3.4.2\backward\iostream.h:31, from C:\Documents and Settings\Standard\Desktop\2004\inserimento.h In file included from C:/Dev-Cpp/include/c++/3.4.2/backward/iostream.h:31, from C:\Documents and Settings\Standard\Desktop\2004\/inserimento.h
6 C:\Documents and Settings\Standard\Desktop\2004\inserimento.h:1, from C:\Documents and Settings\Standard\Desktop\2004\prova.cpp from C:\Documents and Settings\Standard\Desktop\2004\/inserimento.h:1, from C:\Documents and Settings\Standard\Desktop\2004\prova.cpp
6 C:\Documents and Settings\Standard\Desktop\2004\prova.cpp from C:\Documents and Settings\Standard\Desktop\2004\prova.cpp
32:2 C:\Dev-Cpp\include\c++\3.4.2\backward\backward_warning.h #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <iostream> instead of the deprecated header <iostream.h>. To disable this warning use -Wno-deprecated.
2 C:\Dev-Cpp\include\mysql\mysql.h:57, from C:\Documents and Settings\Standard\Desktop\2004\inserimento.h In file included from C:/Dev-Cpp/include/mysql/mysql.h:57, from C:\Documents and Settings\Standard\Desktop\2004\/inserimento.h
6 C:\Documents and Settings\Standard\Desktop\2004\inserimento.h:2, from C:\Documents and Settings\Standard\Desktop\2004\prova.cpp from C:\Documents and Settings\Standard\Desktop\2004\/inserimento.h:2, from C:\Documents and Settings\Standard\Desktop\2004\prova.cpp
6 C:\Documents and Settings\Standard\Desktop\2004\prova.cpp from C:\Documents and Settings\Standard\Desktop\2004\prova.cpp
175 C:\Dev-Cpp\include\mysql\mysql_com.h `SOCKET' does not name a type
339 C:\Dev-Cpp\include\mysql\mysql_com.h `SOCKET' was not declared in this scope
339 C:\Dev-Cpp\include\mysql\mysql_com.h expected primary-expression before "const"
339 C:\Dev-Cpp\include\mysql\mysql_com.h expected primary-expression before "unsigned"
340 C:\Dev-Cpp\include\mysql\mysql_com.h expected primary-expression before "unsigned"
340 C:\Dev-Cpp\include\mysql\mysql_com.h initializer expression list treated as compound expression
e ora...????
Ultima modifica effettuata da maury il 28/07/2009 alle 1:30
Per gli include intendevo correggere solo quelle che esistono in C++ ... Fai la prova inserendo gli include in questo ordine (e non usare windows.h ma winalleg.h)
Grazie mille funziona benissimo....
però non capisco dove sbagliavo xk io ho appena finito il terzo anno di ITI, (con indirizzo informatico) e a noi hanno sempre insegnato a includere i file header conosciuti dal c++ in quel modo...
Grazie infinite per l'aiuto..