Qt - Database Module in Windows 7 and Linux



  • Let me tell you how is my enviroment. I need my application to works in Windows 7 64 bits and in Linux 64 bits. Working in Linux is quite easy becase apt-get installs just what I need. If I need support for Database, apt-get install libqt4-mysql fix my problem and the code I generate with Qt-Creator is 64 bits native, since I use G++ 64 bits.

    My problem bring up when I want to do the same in Windows 7 64 bits. If I download the SDK for windows, it uses MinGW32 bits. I mean, qt-creator use mingw32 to generate code, therefore the code generated is 32 bits. So, I decided to download the source and compile that with Visual Studio 2005 whose generate 64 bits. But I am not sure where the source code is. On other hand I think that source code can no be compiled using visual studio 2005. If so, please, could you tell me any work around to have my qt libraries in 64 bits in windows and with database support? at least for mysql...

    Thanks in advance.



  • mingw is used to compile code, not to generate code. Code is text :-)

    bq. o, I decided to download the source and compile that with Visual Studio 2005 whose generate 64 bits. But I am not sure where the source code is.

    Which source code? for Qt? it's in the downloaded package.

    bq. On other hand I think that source code can no be compiled using visual studio 2005.

    And why should source code not be compilable with MSVS2005? By the wy, windows7 is officially supported by MSVS2008. Look "here":http://doc.qt.nokia.com/latest/supported-platforms.html

    bq. If so, please, could you tell me any work around to have my qt libraries in 64 bits in windows and with database support? at least for mysql…

    You have to compile Qt with a supported compiler for the correspondignplatform. MSVS2008 and 2005 both support compiling for 64 bit. And with the Qt distribution, there should be adescription, how to compile (call configure, nmake).



  • Okey, so, what is supposed I should say? "Generate 64 native object code?, executable?"

    How do you compile using msvs2005, I have tried with nmake, but I didnt work.

    On other hand I have license for VS2005 but not for VS2008. I could download express edition but I dont know how to generate 64 native (code, executable, object) with the express edition. I am not sure if it is possible.

    So, what I should do is to download the source for VS2008 and compile it isnt it? but how should I choose database support to be included? By default, in the executable download, database drivers for mysql is not included.

    Thans you very much in advance.



  • The compiler and linker of MSVS are always free. only the IDE need a license.
    But what did not work with nmake? The source code of Qt is compiler independant.

    How did you use nmake to build Qt? I can guarantee that it is possible, we do it at work also, (MSVS 2005 and 2008 for 32 and 64 bit).



  • Really? Sounds good, because that is what I must do as well.
    Once I download de source, what must I do before run nmake? How must I configure the proyect?



  • download the MSVS2008 compiled binaries of Qt and Qt Addin. It seems it's not allowed to compile for MSVS2008 manually in OpenSource version.



  • But, the compiled binary havent support for database by default. Only sqLite but I need for mysql, that is why i wanted to compile sources.

    It there any way to support mysql database module using the binaries?



  • you might use QODBC. Then you should download mysql odbc connector from http://dev.mysql.com/downloads/connector/odbc/5.1.html



  • That could be a good work around but I am interested in using the mysql native driver. It usually give me a better performance. I dont know because everything is so unnecessary complex in Windows. In linux everything seems to be better structured.



  • when you donwloaded Qt sources, unzip them to a folder: <QTDIR>.
    Open a MSVS command prompt, go to <QTDIR>, call configure --help
    then call configure with the parameters you need, there you casn specify, which DB-drives should be compiled. For some of them, you need some extra libraries (Orcale etc.).
    when confige is through, you can call nmake and it builds Qt. But in between, you get go and have some coffee (or some more, it takes time). If you want to build Qt in a way, it can be statically linked, look at this wiki page (in the example, gcc is used, but static build with MSVS is nearly the same...): "BuildStaticQtForWindowsWithGccGerman":http://developer.qt.nokia.com/wiki/BuildStaticQtForWindowsWithGccGerman I'm pretty shure, gcc can also build 64 bit binaries.

    If you search thge wiki, you could also find this article: "#

    Building Qt Desktop for Windows with MSVC":http://developer.qt.nokia.com/wiki/Building_Qt_Desktop_for_Windows_with_MSVC



  • i preffer using mysql service too! but unfortunately it doesn't supported by MSVS2008 binaries



  • If it's not supported by the binary packages, build it on your machine...



  • good. Thanks very much to all of you that have help me. It is a pleasure staying here.



  • [quote author="mohsen" date="1295784462"]download the MSVS2008 compiled binaries of Qt and Qt Addin. It seems it's not allowed to compile for MSVS2008 manually in OpenSource version. [/quote]

    This is wrong. The (L)GPL version does not have any constraints about the compilers. Qt/Nokia does not provide prebuilt binaries, though. Nothing prevents you from compiling yourself.



  • @Volker:
    I just remembered when i was trying to compile for VS with older versions but VS was not at the list of platforms.

    It seems Qt currently provides configuration for VS on opensource version too.



  • In earlier versions, the MSVS integration was not in Open source editiopns, and perhaps the MSVS configs. But is was never said, that compiler might not be used. Before 4.x (3?), k there was no open source version for windows....

    with Qt 4.3, there was a "minGW version for open source for windows":http://labs.qt.nokia.com/2007/09/18/qtwindows-open-source-edition-to-support-vs-express/

    As stated in that article, since 4.4 it is also open source for windows with MSVS compiler.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.