PDA

View Full Version : Qt4 -vs6-w2k



dKoder
2nd November 2006, 21:02
I'm having a problem creating the Hello World example.


I installed the windows OpenSource version of QT 4.2.1. Having done so I could not get (Build Debug Libraries). On one of the QT forums someone suggested that if I installed mingw32-make-3.80.0-3 seperately that that would solve the problem. It did. I was able to build the debug libraries. (I mention this so that you will know how I got to where I am)

Assuming the install was working correctly I started my introduction to QT by working with the examples. I typed in the infamous 'Hello World' examle, changed to the helloWorld directory, and tried to compile it.

/* hello.pro my version using excerpts from the docs */

qmake -win32 -makefile -hello.pro
qmake

qmake generates a Makefile.Debug and a Makefile.Release file but no executable.

Then I tried:

qmake -project
qmake -win32 -makefile -helloWorld.pro /*QT's version of the helloWorld.pro file*/
qmake

Outcome was the same

I noticed some examples here that also used make so I tried 'make'. I received the following error.

C:\QT\projects\helloWorld>make
mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory `C:/QT/projects/helloWorld'
g++ -c -g -g -Wall -frtti -fexceptions -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL
-DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"C:/Qt/4.2.1/
include/QtCore" -I"C:/Qt/4.2.1/include/QtCore" -I"C:/Qt/4.2.1/include/QtGui" -I"
C:/Qt/4.2.1/include/QtGui" -I"C:/Qt/4.2.1/include" -I"C:/Qt/4.2.1/include/Active
Qt" -I"debug" -I"." -I"..\..\..\Qt\4.2.1\mkspecs\win32-g++" -o debug\main.o main
.cpp
'g++' is not recognized as an internal or external command,
operable program or batch file.
mingw32-make[1]: *** [debug\main.o] Error 1
mingw32-make[1]: Leaving directory `C:/QT/projects/helloWorld'
mingw32-make: *** [debug] Error 2


Does anyone have any idea what I need to do here? After four days of configuring, searching docs and forums I'm about ready to delete QT and write it off as a bad experience.

jacek
2nd November 2006, 21:07
qmake generates a Makefile.Debug and a Makefile.Release file but no executable.
Now you should run make (MinGW calls it mingw32-make) to compile your application. qmake is only a tool that generates makefiles.

dKoder
2nd November 2006, 21:11
I tried ming32-make and received the following message. Is there some other part of ming.* I need to install?

C:\QT\projects\helloWorld>ming32-make
'ming32-make' is not recognized as an internal or external command,
operable program or batch file.

Thanks for the quick reply.

jacek
2nd November 2006, 21:13
'g++' is not recognized as an internal or external command,
operable program or batch file.
It looks like MinGW wasn't installed or configured properly. Check your environment variables.

Do you use "Qt 4.x.x Command Prompt" (Start -> Qt by Trolltech v4.x.x (OpenSource) -> Qt 4.x.x Command Prompt)?


I'm about ready to delete QT and write it off as a bad experience.
Your problem has nothing to do with Qt.


C:\QT\projects\helloWorld>ming32-make
'ming32-make' is not recognized as an internal or external command,
mingw32-make

But it looks like make itself works. What did you install exactly?

dKoder
2nd November 2006, 21:22
I installed the open source version 4.2.1 of QT. When I tried to build the debug libraries I got a list of errors. I then searched the net and found this and other forums. One of the forums suggested that I remove the MinGW app and download and install it seperately. I did that. Having reinstalled MinGW the build debug libraries portion built successfully. Everything else has worked without a hitch until the 'make' portion of the compile.

dKoder

jacek
2nd November 2006, 21:34
One of the forums suggested that I remove the MinGW app and download and install it seperately.
And what did you download?

dKoder
2nd November 2006, 21:46
Not exactly. I do use the QT command prompt though. When I open QT command prompt i'm greeted with the following:

Setting up a MinGW/Qt only environment...
-- QTDIR set to C:\Qt\4.2.1
-- PATH set to C:\Qt\4.2.1\bin
-- Adding C:\MinGW\bin to PATH
-- Adding C:\WINNT\System32 to PATH
-- QMAKESPEC set to win32-g++

C:\Qt\4.2.1>

At this point I change to the helloWorld directory and enter the qMake commands as stated above.

jacek
2nd November 2006, 23:56
-- Adding C:\MinGW\bin to PATH
Where did you install MinGW?

dKoder
3rd November 2006, 00:32
MinGW installed in "c:\mingw". I put an entry in the autoexec.bat to include it in the path. But whats confusing me is the error states that g++ is not recognized as a command. See below:
What can I do to check that?


Qt" -I"debug" -I"." -I"..\..\..\Qt\4.2.1\mkspecs\win32-g++" -o debug\main.o main
.cpp
'g++' is not recognized as an internal or external command,

jacek
3rd November 2006, 00:57
What can I do to check that?
Check whether you have g++.exe in C:\MinGW\bin.

dKoder
3rd November 2006, 01:55
No sir. G++.exe is not there. I check the MinGW site and I didn't see anything that looked like a winders version.

jacek
3rd November 2006, 11:31
No sir. G++.exe is not there.
What about mingw32-g++.exe? Which file did you download and install from MinGW site?

dKoder
3rd November 2006, 15:16
This one mingw32-make-3.80.0-3.exe.

jacek
3rd November 2006, 15:41
This one mingw32-make-3.80.0-3.exe.
That explains everything. This file contains only the make program, not the whole toolchain.

Try this: http://prdownloads.sourceforge.net/mingw/MinGW-4.1.1.exe

dKoder
3rd November 2006, 16:39
Well... I installed the right minGW file, corrected the path in the Autoexec.bat file, and I still have the same problem.

C:\Qt\4.2.1>mingw32-make
mingw32-make -f Makefile.Debug all
mingw32-make[1]: Entering directory `C:/Qt/4.2.1'
g++ -c -g -g -Wall -frtti -fexceptions -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL
-DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"C:/Qt/4.2.1/
include/QtCore" -I"C:/Qt/4.2.1/include/QtCore" -I"C:/Qt/4.2.1/include/QtGui" -I"
C:/Qt/4.2.1/include/QtGui" -I"C:/Qt/4.2.1/include" -I"C:/Qt/4.2.1/include/Active
Qt" -I"tmp\moc\debug_shared" -I"c:\qt\projects\helloWorld" -I"." -I"mkspecs\win3
2-g++" -o tmp\obj\debug_shared\main.o c:\qt\projects\helloWorld\main.cpp
'g++' is not recognized as an internal or external command,
operable program or batch file.
mingw32-make[1]: *** [tmp\obj\debug_shared\main.o] Error 1
mingw32-make[1]: Leaving directory `C:/Qt/4.2.1'
mingw32-make: *** [debug-all] Error 2

The error states that g++ is not recognized... Do I need to rebuild the debug libraries?

jacek
3rd November 2006, 16:49
I installed the right minGW file
Where did you install it? Did it install g++.exe there?


Do I need to rebuild the debug libraries?
Start from installing the compiler.

dKoder
3rd November 2006, 17:44
Here we go again...

I uninstalled QT and minGW and then reinstalled the Windows OpenSource version of QT. Then I ran the (Build Debug Libraries) which produced the follow:

Qt is now configured for building. Just run mingw32-make.
To reconfigure, run mingw32-make clean and configure.

(cd winmain && mingw32-make -f Makefile debug)
mingw32-make[1]: Entering directory `C:/Qt/4.2.1/src/winmain'
mingw32-make -f Makefile.Debug
mingw32-make[2]: Entering directory `C:/Qt/4.2.1/src/winmain'
g++ -c -g -g -Wall -frtti -fexceptions -DQT_THREAD_SUPPORT -DUNICODE -DQT_LARGEF
ILE_SUPPORT -DQT_NEEDS_QMAIN -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT
3_SUPPORT -DQT_MOC_COMPAT -I"C:/Qt/4.2.1/include" -I"tmp" -I"C:/Qt/4.2.1/include
/QtCore" -I"c:\Qt\4.2.1\include\qtmain" -I"tmp" -I"C:/Qt/4.2.1/include/ActiveQt"
-I"tmp\moc\debug_shared" -I"." -I"..\..\mkspecs\win32-g++" -o tmp\obj\debug_sha
red\qtmain_win.o qtmain_win.cpp
ar -ru "..\..\lib\libqtmaind.a" tmp\obj\debug_shared\qtmain_win.o
mingw32-make[2]: Leaving directory `C:/Qt/4.2.1/src/winmain'
mingw32-make[1]: Leaving directory `C:/Qt/4.2.1/src/winmain'
(cd tools/moc && mingw32-make -f Makefile first)
mingw32-make[1]: Makefile: No such file or directory
mingw32-make[1]: *** No rule to make target `Makefile'. Stop.
mingw32-make[1]: Entering directory `C:/Qt/4.2.1/src/tools'
mingw32-make[1]: Leaving directory `C:/Qt/4.2.1/src/tools'
mingw32-make: *** [debug-tools/moc] Error 2
C:\Qt\4.2.1\src>

What is moc? Do I need to install the as well?

Frustrated to no end!

jacek
3rd November 2006, 18:13
I uninstalled QT and minGW and then reinstalled the Windows OpenSource version of QT. Then I ran the (Build Debug Libraries) which produced the follow:
I've just installed Qt 4.2.1 Open Source and ran "Build Debug Libraries". It looks like everything works OK on my system, so there must be something on your system that blocks the build. Maybe you have run out of free disk space?

You can always recompile Qt using the configure utility.


What is moc? Do I need to install the as well?
No, moc (meta-object compiler) is an utility that comes with Qt.

dKoder
3rd November 2006, 18:19
So what are my options now?

It's late in the game do I punt or pass?

dKoder
3rd November 2006, 23:39
Well I deleted QT & minWG and reinstalled everything. I ran configure (contents of configure.cache are as follows)

-platform
win32-g++
-debug-and-release
-plugin-sql-mysql
-plugin-sql-psql
-plugin-sql-sqlite
-no-qt3support
-qt-style-windows
-saveconfig

Then I ran the (Build Debug Libraries). After 30-45 minutes or so I'm greated with the folowing errors.

mingw32-make[5]: Entering directory `C:/Qt/4.2.1/src/plugins/sqldrivers/psql'
g++ -c -g -g -frtti -fexceptions -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_NO_
CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_DLL -DQT_PLUGIN -DQT_SQL_LIB -DQT_COR
E_LIB -DQT_THREAD_SUPPORT -I"C:/Qt/4.2.1/include/QtCore" -I"C:/Qt/4.2.1/include/
QtCore" -I"C:/Qt/4.2.1/include/QtSql" -I"C:/Qt/4.2.1/include/QtSql" -I"C:/Qt/4.2
.1/include" -I"C:/Qt/4.2.1/include/ActiveQt" -I"tmp\moc\debug_shared" -I"." -I".
.\..\..\..\mkspecs\win32-g++" -o tmp\obj\debug_shared\main.o main.cpp
----------------------
HAD TO REMOVE SEVERAL LINES BECAUSE IT EXCEED THE CHARTER LIMIT FOR THE POST.
----------------------
mingw32-make[5]: *** [tmp\obj\debug_shared\qsql_psql.o] Error 1
mingw32-make[5]: Leaving directory `C:/Qt/4.2.1/src/plugins/sqldrivers/psql'
mingw32-make[4]: *** [debug-all] Error 2
mingw32-make[4]: Leaving directory `C:/Qt/4.2.1/src/plugins/sqldrivers/psql'
mingw32-make[3]: *** [sub-psql-make_default] Error 2
mingw32-make[3]: Leaving directory `C:/Qt/4.2.1/src/plugins/sqldrivers'
mingw32-make[2]: *** [sub-sqldrivers-make_default] Error 2
mingw32-make[2]: Leaving directory `C:/Qt/4.2.1/src/plugins'
mingw32-make[1]: *** [sub-plugins-make_default] Error 2
mingw32-make[1]: Leaving directory `C:/Qt/4.2.1/src'
mingw32-make: *** [sub-src-make_default-ordered] Error 2

I have a Linux server with both MySQL & Postgres running. I use them both daily, almost, and I have a copy of sqlite on my local machine. During the install the only database QT finds is sqlite and therefore it only builds driver for that database. The first question that comes to mind is why in the sam hill should QT can one way or another whether it can find databases before it will build the drivers? That makes absolutely no sense to me! Anyway, I change to the src/plugins/sqldrivers directory and attempt to build the MySql driver and I get the following errors:

C:\Qt\4.2.1\src\plugins\sqldrivers\mysql>mingw32-make
mingw32-make -f Makefile.Debug all
mingw32-make[1]: Entering directory `C:/Qt/4.2.1/src/plugins/sqldrivers/mysql'
g++ -c -g -g -frtti -fexceptions -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_NO_
CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_DLL -DQT_PLUGIN -DQT_SQL_LIB -DQT_COR
E_LIB -DQT_THREAD_SUPPORT -I"C:/Qt/4.2.1/include/QtCore" -I"C:/Qt/4.2.1/include/
QtCore" -I"C:/Qt/4.2.1/include/QtSql" -I"C:/Qt/4.2.1/include/QtSql" -I"C:/Qt/4.2
.1/include" -I"C:/Qt/4.2.1/include/ActiveQt" -I"tmp\moc\debug_shared" -I"." -I".
.\..\..\..\mkspecs\win32-g++" -o tmp\obj\debug_shared\main.o main.cpp
In file included from main.cpp:26:
../../../sql/drivers/mysql/qsql_mysql.h:34:19: mysql.h: No such file or director
y
In file included from main.cpp:26:
../../../sql/drivers/mysql/qsql_mysql.h:85: error: expected `)' before '*' token

mingw32-make[1]: *** [tmp\obj\debug_shared\main.o] Error 1
mingw32-make[1]: Leaving directory `C:/Qt/4.2.1/src/plugins/sqldrivers/mysql'
mingw32-make: *** [debug-all] Error 2

Then I try the postgres driver and I get a similar lenghty error.

I have been trying to get QT to install since last Friday and I don't feel I'm any better off that when I started. Will someone show some conpasion and just shoot me?

gfunk
3rd November 2006, 23:41
Take a timeout! What are your other options? java? wxWidgets?

If you can spare it, and have experience with Visual Studio, get the commercial edition of Qt w/ the VS integration, it'll be wayyyy easier to use.

jacek
3rd November 2006, 23:58
-plugin-sql-mysql
-plugin-sql-psql
If you want to build those plugins you must tell Qt where it can find proper libraries. For example like this:
configure -plugin-sql-psql -I C:\Postgres\include -L C:\Postgres\lib
make
(where C:\Postgres is a directory where PostgreSQL libraries were installed).

Everything is explained here: http://doc.trolltech.com/4.2/sql-driver.html#qpsql-for-postgresql-version-7-3-and-above
Note also that you can compile those plugins later (just remember that you shouldn't use paths with spaces).


I have been trying to get QT to install since last Friday and I don't feel I'm any better off that when I started. Will someone show some conpasion and just shoot me?
But you're making a lot of progress. Now you have a working toolchain and you got past that problem with moc compilation.

dKoder
4th November 2006, 00:03
This is true, however now qmake doesn't work. Before qmake worked to make the Makefile but minwg-32-make didn't now things are reversed and minwg-32-make works and qmake doesen't. So I can't even build the drivers.

jacek
4th November 2006, 00:13
This is true however qmake doesn't. Before qmake worked to make the Makefile but minwg-32-make didn't now things are reversed and minwg-32-make works and qmake doesen't. So I can't even build the drivers.
Delete the C:\Qt\4.2.1\configure.cache file, open "Qt 4.x.x Command Prompt", run configure (without any parameters) and then mingw32-make and tell me what happened.

dKoder
4th November 2006, 05:06
Quick check of executables follows:

C:\Qt\projects\helloWorld>qmake
'qmake' is not recognized as an internal or external command,
operable program or batch file.

C:\Qt\projects\helloWorld>mingw32-make
mingw32-make: *** No targets specified and no makefile found. Stop.

jacek
4th November 2006, 12:26
C:\Qt\projects\helloWorld>qmake
'qmake' is not recognized as an internal or external command,
operable program or batch file.
Have you tried it from the "Qt 4.x.x Command Prompt"? Is "C:\Qt\4.1.2\bin" included in PATH environment variable?

dKoder
4th November 2006, 17:03
To answer your question, no. However when I added "C:\QT\4.2.1\bin" to the path, run qmake and mingw32 I actually get an executable. "hello.exe" However when I run the executable I get several errors resulting in 'can find *.dll'. I tried moving the EXE to the QT directory, which is in the PATH, but I get the same errors. But, at least I'm creating an exe now. So there is now a dim light at the end of this very long tunnel.

Thanks for sticking with me!

jacek
4th November 2006, 17:17
when I run the executable I get several errors resulting in 'can find *.dll'.
Copy all of those DLLs to the directory where your executable is and it should run. You can also add C:\Qt\4.2.1\lib to some environment variable, but I don't remember which one (search the MSDN for information where windows looks for DLLs and in what order).

dKoder
4th November 2006, 17:40
Now I'm really getting somewhere. I have an working exe .

If you remember you had me to rerun Configure without any parameters. Do I dare run it again with the desired parameters?

jacek
4th November 2006, 18:07
If you remember you had me to rerun Configure without any parameters. Do I dare run it again with the desired parameters?
It should work without any problems, just remember that if you want to compile PostgreSQL or MySQL driver, you have to add -I and -L options with proper values.