January 23, 2011

josemaria josemaria
Lab Rat
20 posts

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.

15 replies

January 23, 2011

Gerolf Gerolf
Hobby Entomologist
3287 posts

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

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.

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 [doc.qt.nokia.com]

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).

 Signature 

Nokia Certified Qt Specialist.
Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

January 23, 2011

josemaria josemaria
Lab Rat
20 posts

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.

January 23, 2011

Gerolf Gerolf
Hobby Entomologist
3287 posts

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).

 Signature 

Nokia Certified Qt Specialist.
Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

January 23, 2011

josemaria josemaria
Lab Rat
20 posts

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?

January 23, 2011

Mohsen Mohsen
Lab Rat
747 posts

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

 Signature 

www.madagon.com

January 23, 2011

josemaria josemaria
Lab Rat
20 posts

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?

January 23, 2011

Mohsen Mohsen
Lab Rat
747 posts

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

 Signature 

www.madagon.com

January 23, 2011

josemaria josemaria
Lab Rat
20 posts

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.

January 23, 2011

Gerolf Gerolf
Hobby Entomologist
3287 posts

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 [developer.qt.nokia.com] 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 [developer.qt.nokia.com]

 Signature 

Nokia Certified Qt Specialist.
Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

January 23, 2011

Mohsen Mohsen
Lab Rat
747 posts

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

 Signature 

www.madagon.com

January 23, 2011

Gerolf Gerolf
Hobby Entomologist
3287 posts

If it’s not supported by the binary packages, build it on your machine…

 Signature 

Nokia Certified Qt Specialist.
Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

January 23, 2011

josemaria josemaria
Lab Rat
20 posts

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

January 23, 2011

Volker Volker
Ant Farmer
5428 posts
mohsen wrote:
download the MSVS2008 compiled binaries of Qt and Qt Addin. It seems it’s not allowed to compile for MSVS2008 manually in OpenSource version.

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.

January 25, 2011

Mohsen Mohsen
Lab Rat
747 posts

@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.

 Signature 

www.madagon.com

January 25, 2011

Gerolf Gerolf
Hobby Entomologist
3287 posts

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 [labs.qt.nokia.com]

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

 Signature 

Nokia Certified Qt Specialist.
Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

 
  ‹‹ Deployment on windows      Visual Studio 2005 and Qt 4.6.3 ››

You must log in to post a reply. Not a member yet? Register here!