Results 1 to 15 of 15

Thread: What are the dll's and lib files to be added for my application ??

  1. #1
    Join Date
    Mar 2011
    Location
    Coimbatore,TamilNadu,India
    Posts
    379
    Thanks
    10
    Thanked 13 Times in 12 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default What are the dll's and lib files to be added for my application ??

    What are the dll's and lib files to be added for my application to run on the Non-Qt installed machine>>

    my source code is::

    Qt Code:
    1. QString host = QHostInfo::localHostName();
    2. QHostInfo hostinfo = QHostInfo::fromName(host);;
    3. QString address = "";
    4. if (!hostinfo.addresses().isEmpty()) {
    5. QList<QHostAddress> list = hostinfo.addresses();
    6. for(int i=0; i<list.count(); i++)
    7. {
    8. QString ip = list[i].toString();
    9. if(!ip.startsWith("0:") && !ip.startsWith("127."))
    10. {
    11. address.append(ip);
    12. break;
    13. }
    14. }
    15. }
    16.  
    17.  
    18. bool ok=false;
    19. QDateTime dateTime = QDateTime::currentDateTime();
    20.  
    21. QString dd=dateTime.toString("yyyy-MM-dd hh:mm:ss");
    22.  
    23. QHostInfo info;
    24. QString IPAddress;
    25. QHostAddress Address;
    26. //QMessageBox::information(this,"","" + info.localHostName() + "");
    27. QString hostname=info.localHostName();
    28. //QMessageBox::warning(NULL,"Hostname",hostname,QMessageBox::Ok);
    29.  
    30.  
    31.  
    32. //QMessageBox::warning(NULL,"DriveList",OrigDateTime,QMessageBox::Ok);
    33.  
    34. QStringList list=QSqlDatabase::drivers();
    35. QString driveList;
    36. for(int i=0;i<list.length();i++)
    37. {
    38. driveList += list[i];
    39. }
    40. //QMessageBox::warning(NULL,"DriveList",driveList,QMessageBox::Ok);
    41. QSqlDatabase db= QSqlDatabase::addDatabase("QMYSQL3");
    42. db.setHostName("172.16.0.1");
    43. db.setDatabaseName("screengrabber");
    44. db.setUserName("scre");
    45. db.setPassword("1234");
    46. ok = db.open();
    47.  
    48. QString servstr="1";
    49. //servstr.number(serv,2);
    50.  
    51. /*QMessageBox::warning(NULL,"IPNAME",ipname,QMessageBox::Ok);
    52.   QMessageBox::warning(NULL,"datetime",datetime,QMessageBox::Ok);
    53.   QMessageBox::warning(NULL,"serv",servstr,QMessageBox::Ok);*/
    54.  
    55.  
    56. QSqlQuery querylog(db);
    57. querylog.exec("INSERT INTO service_log (ip_address,date_time, service_status, logged_user)VALUES (?,?,?,?)");
    58. querylog.bindValue(0,address);
    59. querylog.bindValue(1,dd);
    60. querylog.bindValue(2,servstr);
    61. querylog.bindValue(3,hostname);
    62.  
    63. /*bool qrylog=querylog.exec("INSERT INTO service_log (ip_address,date_time, service_status, logged_user)"
    64.   "VALUES ('172.16.0.51','2011-07-28 15:55:09',1,'ramachandran')");*/
    65.  
    66. bool qrylog= querylog.exec();
    67. /*QString success = querylog.lastError().text();
    68.   QMessageBox::warning(NULL,"Error",success,QMessageBox::Ok);
    69.   QString execquery=querylog.executedQuery();*/
    70. //QMessageBox::warning(NULL,"Executed Query",execquery,QMessageBox::Ok);
    71.  
    72. //QHostAddress info1=info.fromName("localhost").addresses().first();
    73.  
    74. db.close();
    75.  
    76.  
    77.  
    78. for(;;)
    79. {
    80.  
    81. /*QSqlDatabase db= QSqlDatabase::addDatabase("QMYSQL3");
    82.   db.setHostName("172.16.0.1");
    83.   db.setDatabaseName("screengrabber");
    84.   db.setUserName("scre");
    85.   db.setPassword("1234");*/
    86. bool opened = db.open();
    87.  
    88.  
    89. originalPixmap =QPixmap();
    90. originalPixmap = QPixmap::grabWindow(QApplication::desktop()->winId());
    91. QString strfname;
    92. strfname.sprintf("%d",c);
    93. originalPixmap.save("C:\\Program Files\\image"+strfname+".jpeg","jpeg");
    94. c++;
    95. char Data;
    96. QFile file("C:\\Program Files\\image"+strfname+".jpeg");
    97. file.open(QIODevice::ReadOnly);
    98. //file.seek(0);
    99. int len=file.size();
    100. //buf=file.read(len);
    101. buf=file.readAll();
    102. file.close();
    103. file.remove();
    104. QSqlQuery query;
    105. query.exec("INSERT INTO log (grab_date, ip_address, image,logged_user) "
    106. "VALUES (?,?,?,?)");
    107. query.bindValue(0,dd);
    108. query.bindValue(1,address);
    109. query.bindValue(2,buf);
    110. query.bindValue (3,hostname);
    111. bool qry=query.exec();
    112.  
    113. int length=buf.length();
    114.  
    115. //QMessageBox::warning(NULL,"DriveList",strquery,QMessageBox::Ok);
    116.  
    117. //QString success1 = query.lastError().text();
    118. //QMessageBox::warning(NULL,"Error",success1,QMessageBox::Ok);
    119. //QString execquery1=query.executedQuery();
    120. //QMessageBox::warning(NULL,"Executed Query",execquery1,QMessageBox::Ok);
    121.  
    122. db.close();
    123.  
    124.  
    125. /*QFile newfile("D:\\img.txt");
    126.   newfile.open(QIODevice::WriteOnly);
    127.   newfile.write(buf);*/
    128.  
    129. int iSecret, iRandom;
    130. iSecret = rand() % 20 + 1;
    131. iRandom=iSecret*60000;
    132.  
    133. QMutex mutex;
    134. mutex.lock();
    135. QWaitCondition waitCondition;
    136. waitCondition.wait(&mutex, iRandom);
    137. mutex.unlock();
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,533
    Thanks
    13
    Thanked 1,576 Times in 1,505 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: What are the dll's and lib files to be added for my application ??

    Start with the ones you list in your PRO file.

  3. #3
    Join Date
    Mar 2011
    Location
    Coimbatore,TamilNadu,India
    Posts
    379
    Thanks
    10
    Thanked 13 Times in 12 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: What are the dll's and lib files to be added for my application ??

    This code works fine in my system, but it fails in the non QT installed machines. I have added the following dlls: libgcc_s_dw2-1.dll,mingwm10.dll,QtCore4.dll,QtCored4.dll,QtGui4 .dll,QtGuid4.dll,QtNetwork4.dll,QtNetworkd4.dll,Qt Sql4.dll,QtSqld4.dll.

    It shows no error while running the exe. but i didnt find the value updated in the database. i have installed MYSQL ODBC Driver 5.1 in the system also.
    Anything need to be included??

    This is my .pro file::

    Qt Code:
    1. TARGET = screenshotnew
    2. TEMPLATE = app
    3.  
    4.  
    5. SOURCES += main.cpp\
    6. qscreenshot.cpp
    7.  
    8. HEADERS += qscreenshot.h
    9.  
    10. FORMS += qscreenshot.ui
    11.  
    12. QT += sql
    13.  
    14. QT += network
    To copy to clipboard, switch view to plain text mode 


    Added after 14 minutes:


    I am getting Driver Not Loaded error while running this set up.. But it works fine while running from the QT Creator.
    Last edited by Gokulnathvc; 30th July 2011 at 06:38.

  4. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,533
    Thanks
    13
    Thanked 1,576 Times in 1,505 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: What are the dll's and lib files to be added for my application ??

    You should not be deploying the debug libraries or a debug version of your program: no need for QtCored4, QtGuid4, QtNetworkd4, QtSqld4

    You need to include the sqldrivers plugins for your database connection. There are plenty of posts in the forum regarding these.

  5. #5
    Join Date
    Mar 2011
    Location
    Coimbatore,TamilNadu,India
    Posts
    379
    Thanks
    10
    Thanked 13 Times in 12 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: What are the dll's and lib files to be added for my application ??

    Could you please help me with my code above and the dll's and lib's to be included in this.

  6. #6
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,533
    Thanks
    13
    Thanked 1,576 Times in 1,505 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: What are the dll's and lib files to be added for my application ??

    I just did.

  7. #7
    Join Date
    Mar 2011
    Location
    Coimbatore,TamilNadu,India
    Posts
    379
    Thanks
    10
    Thanked 13 Times in 12 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: What are the dll's and lib files to be added for my application ??

    How to include the SQL driver plugins?? Please help me..

  8. #8
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,533
    Thanks
    13
    Thanked 1,576 Times in 1,505 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: What are the dll's and lib files to be added for my application ??

    Please you try something for yourself before asking for help. What did you actually try in the 30 minutes between my last post and yours?

    QODBC for Open Database Connectivity (ODBC) tell you how the plugin is built. It also gives you a hint about where the plugin might be found (the same hint I have already given you). Deploying an Application on Windows tells you about deploying applications and has a section dedicated to plugins. Put the right plugin file in the right subdirectory of your application folder and all is good.

  9. #9
    Join Date
    Mar 2011
    Location
    Coimbatore,TamilNadu,India
    Posts
    379
    Thanks
    10
    Thanked 13 Times in 12 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: What are the dll's and lib files to be added for my application ??

    Can anyone help me with the codes above, both cpp file and Pro file. How to build this successfully, It works fine with QT Creator, but while using the exe outside, it says driver not loaded. How to fix this with the above code in it..

  10. #10
    Join Date
    Jun 2011
    Location
    Chennai, India
    Posts
    30
    Thanks
    13
    Thanked 6 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: What are the dll's and lib files to be added for my application ??

    put your mysql plugin dll in a directory called "sqldrivers" and put that folder where you have your exe. It should work fine.

  11. #11
    Join Date
    Mar 2011
    Location
    Coimbatore,TamilNadu,India
    Posts
    379
    Thanks
    10
    Thanked 13 Times in 12 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: What are the dll's and lib files to be added for my application ??

    I have tried with the mysql dlls in sqldrivers plugin also, but it says the same" Driver not loaded"

  12. #12
    Join Date
    Mar 2011
    Location
    Coimbatore,TamilNadu,India
    Posts
    379
    Thanks
    10
    Thanked 13 Times in 12 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: What are the dll's and lib files to be added for my application ??

    I have copied all the sql drivers plugins and other dlls into the directory, but still its gives Driver not loaded error. But it works fine in Qt Creator. As an exe it gives the error.

  13. #13
    Join Date
    Nov 2010
    Location
    Budapest, Hungary
    Posts
    125
    Thanks
    17
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: What are the dll's and lib files to be added for my application ??

    I had much of trouble with this issue before. So first you can try starting the application and give the dlls that it is missing for running. Than if it still cannot run then try using a process monitor - you can monitor what dll-s are in use when running and what your program looks for. pay attention that there are 2 folders in the Qt folder in which you find dlls, but I've forgotten which one was the good one.
    Szilvi

  14. #14
    Join Date
    Mar 2011
    Location
    Coimbatore,TamilNadu,India
    Posts
    379
    Thanks
    10
    Thanked 13 Times in 12 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: What are the dll's and lib files to be added for my application ??

    I have added almost all the dll's it shows while running. Now it is not showing any errors, But i have used message box to show whether the connection succeeds or not, in that message box it shows, Driver Not loaded.

  15. #15
    Join Date
    Jun 2011
    Location
    Chennai, India
    Posts
    30
    Thanks
    13
    Thanked 6 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: What are the dll's and lib files to be added for my application ??

    try using QApplication::addLibraryPath(<PATH_TO_DLLS>) in the main after you create the QApplication(or QCoreApplication) object
    Last edited by gkarthick5; 2nd August 2011 at 12:42. Reason: spelling corrections

Similar Threads

  1. QML files in QT application
    By nageshvk in forum Qt Quick
    Replies: 8
    Last Post: 1st December 2010, 07:03
  2. Replies: 1
    Last Post: 28th October 2010, 22:36
  3. To identify executable and other files in QT Application
    By augusbas in forum Qt Programming
    Replies: 3
    Last Post: 8th March 2010, 18:29
  4. Installation of application data files
    By anderssonj in forum Qt Programming
    Replies: 1
    Last Post: 4th July 2007, 16:02
  5. How to open IGES files in Qt Application?
    By Shuchi Agrawal in forum Newbie
    Replies: 1
    Last Post: 21st February 2007, 01:06

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.