Hi,
Thakyou for your reply, I had take a new project, after that i had add three LineEdit control and three pushbuttons. After that i write the code for working that. then it is worked. After that i wish to insert that values into a table ( MYSQL ). Then i get into the net and get the code. I paste that code in main.cpp and give the command for make.
I had replace the special character ( ie, ->, , et ). After this i give the command " qmake -o Makefile mark.pro " then there is no error display.
But after that i give the command "make" then the error message is display
The code is
=================================
QsqlDatabase *defaultDB=QsqlDatabase::addDatabase("QMYSQL3");
defaultDB->setDatabaseName("test");
defaultDB->setPassword("");
defaultDB->setHostName("localhost");
if(defaultDB->open())
{
qWarning("Database connection successful");
}
else
{
qWarning("Database connection failed");
return a.exec();
}
=====================
The error is
==============================
g++ -c -pipe -Wall -W -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -m32 -march=i386 -mtune=pentium4 -fasynchronous-unwind-tables -DQT_NO_DEBUG -DQT_SHARED -DQT_THREAD_SUPPORT -I/usr/lib/qt-3.3/mkspecs/default -I. -I/usr/lib/qt-3.3/include -I.ui/ -I. -I.moc/ -o .obj/main.o main.cpp
main.cpp:6:28: error: connection.h: No such file or directory
.ui/FarkData.h:47: error: ISO C++ forbids declaration of ‘QSqlDatabase’ with no type
/usr/lib/qt-3.3/include/qsqldatabase.h:63: warning: ‘class QSqlDriverCreatorBase’ has virtual functions but non-virtual destructor
main.cpp: In function ‘int main(int, char**)’:
main.cpp:12: error: ‘QsqlDatabase’ was not declared in this scope
main.cpp:12: error: ‘defaultDB’ was not declared in this scope
main.cpp:12: error: ‘QsqlDatabase’ is not a class or namespace
main.cpp:12: error: ‘addDatabase’ was not declared in this scope
make: *** [.obj/main.o] Error 1
================================================== =====
After this I try for another code and get a new one, that is
==================================
QSqlDatabase *defaultDB = QSqlDatabase::addDatabase( "QMYSQL" );
defaultDB->setDatabaseName( "test" );
defaultDB->setUserName( "root" );
defaultDB->setPassword( "" );
defaultDB->setHostName( "localhost");
if ( defaultDB->open() ) {
printf("Sucessfully Connected \n");
// Database successfully opened; we can now issue SQL commands.
}
===================================
then i give the command
qmake -o Makefile mark.pro
no error display... When i give the command
make
then the following error display...
====================================
/usr/lib/qt-3.3/bin/uic FarkData.ui -o .ui/FarkData.h
g++ -c -pipe -Wall -W -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -m32 -march=i386 -mtune=pentium4 -fasynchronous-unwind-tables -DQT_NO_DEBUG -DQT_SHARED -DQT_THREAD_SUPPORT -I/usr/lib/qt-3.3/mkspecs/default -I. -I/usr/lib/qt-3.3/include -I.ui/ -I. -I.moc/ -o .obj/main.o main.cpp
main.cpp:6:28: error: connection.h: No such file or directory
.ui/FarkData.h:47: error: ISO C++ forbids declaration of ‘QSqlDatabase’ with no type
/usr/lib/qt-3.3/include/qsqldatabase.h:63: warning: ‘class QSqlDriverCreatorBase’ has virtual functions but non-virtual destructor
make: *** [.obj/main.o] Error 1
==================================
please help me sir....
thankyou...
Sabeesh




Reply With Quote
Bookmarks