PDA

View Full Version : "mainwindows" Example



Seth
15th April 2007, 00:23
Hi All,

trying to run the "mainwindows" example that came with Qt 4.2.3

These complied okay
qmake -project
qmake mainwindows.pro

Choked when I ran
make

Shouldn't I be able to just run this program strait from its folder?

What file can I attach to show you the errors?

Thanks in advance:)

wysota
15th April 2007, 01:34
What do you mean by "choked"? And why did you run "qmake -project"? Didn't the example already have a project file?

Seth
15th April 2007, 01:56
Wysota, Yes, the example did have the -project file already in the folder. I ran it because thats how I did the tutorial examples, "hello", etc...

Did I cause a mishap by re-running"qmake -project"?

Choked I mean, the command prompt had like 100's of lines of gibberish. No .exe showed up in the DEBUG folder.

Is there a "log" somewhere so I can attach to show you the 100's of lines of gibberish.

Using the word "gibberish" because I dont know what all the lines mean on the command prompt.

marcel
15th April 2007, 02:32
You can attach a file to your post...
It's the "Manage attachements" button below...

Regards

Seth
15th April 2007, 02:41
Marcel, thanks but how do I pull (copy/paste) the data from the command prompt?

Is there some sort of "log" file that is generated that shows all the data (text) from the command prompt when "make" is executed?

marcel
15th April 2007, 02:44
Yes, actually...
When running qmake to compile th example do this:

qmake ... > qmake_output.txt

EDIT: "..." stands for the actual options that you would give to qmake

This will generate the file qmake_output.txt in the same folder. It means it will direction the console output to a file.
You can attach that.

marcel
15th April 2007, 03:01
Also, qmake hast the "-o file" option. The output will be written to the file you specify :).

Seth
15th April 2007, 03:02
Marcel,

Iteresting, I just ran "qmake" instead of "make" and didnt get any errors or gibberish.

However, in the DEBUG file there is no .exe file to launch the program. The DEBUG file is empty.

How do we launch a program? Shouldnt there be a .exe file somewhere?

No where in the "mainwindows" folder was a file generated called "qmake_output.txt"

Attached is a qmake file, dont know if you can use it for debugging

Thanks in advance

marcel
15th April 2007, 03:06
Were you using make? :) Not good...qmake projects are not compatible with normal makefiles.
Check the Release folder for the executable...

marcel
15th April 2007, 03:09
The release folder in every folder in the mainwindows example...

regards

Seth
15th April 2007, 03:10
The RELEASE folder is empty as well.

Why cant I use "make"? I used it for the "hello" program and such.

marcel
15th April 2007, 03:16
If you want debugging information. add CONFIG += qt debug.
to use the plain, old make, you'll have to qmake -o Makefile mainwindows.pro ( sorry about before, -o is not for log ).
After this you can use make. As I said, a .pro file is not the same with a makefile( different syntax for start ).

Seth
15th April 2007, 03:22
Marcel, I am so new to programming.

What is
add CONFIG += qt debug and where do I add that?

Also, what is
-o and where do I add that?

Also, why arent I seeing an executable anywhere?

When I ran "qmake" on the command line it didnt give me errors so I should have seen an executable somewhere, correct?

marcel
15th April 2007, 03:33
No, you have to use the platform make to build the project after you generate a makefile with qmake.

Use nmake if you have Visual Studio or make if you have gcc.

regards

marcel
15th April 2007, 03:56
STEPS:

1. qmake -project in mainwindows
2. qmake -project in the subfolders (if you deleted the makefiles and .pro files )
3. qmake in mainwindows
4. qmake in subfolders
5 make or nmake in mainwindows

Should work fine and generate all executables in the Release folders.

wysota
15th April 2007, 08:42
Hold on!

Calling "qmake -project" destroys a perfectly good project file. You musn't call it. Please bring it back from the original archive and then run qmake and make (without qmake -project).

"-o" option for qmake tells it how to name the Makefile and not where to redirect the messages.

Seth
15th April 2007, 14:39
Wysota,


Please bring it back from the original archive and then run qmake and make (without qmake -project).

since I ran qmake -project from its original folder I may have destroyed the original.

1) Is there another copy somewhere else?

I cant seem to find this mainwindows example on the Trolltech website. The example comes standard with Qt 4.2.3 (C:\Qt\4.2.3\examples\mainwindows).

2) Should Trolltech have this mainwindows example somewhere on their website?

Thanks in advance!!!

wysota
15th April 2007, 14:52
since I ran qmake -project from its original folder I may have destroyed the original.

1) Is there another copy somewhere else?

Yes, in a source archive available from for example www.trolltech.com :) Download the zip and replace the example files.

The top level project file looks as follows:

TEMPLATE = subdirs
SUBDIRS = application \
dockwidgets \
mdi \
menus \
recentfiles \
sdi

# install
target.path = $$[QT_INSTALL_EXAMPLES]/mainwindows
sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS mainwindows.pro README
sources.path = $$[QT_INSTALL_EXAMPLES]/mainwindows
INSTALLS += target sources

If you didn't ruin project files in subdirectories, this is all you need.

Seth
15th April 2007, 15:46
Wysota

Good progress (I think)!! I went into archive and got a new "mainwindows" example file and ran qmake and make only and it looks like everything ran smoothly. Thanks for that help!

But where is the executable? There is no DEBUG or RELEASE folder under the mainwindows folder.

There is a RELEASE folder in every subfolder (application, dockwidgets, mdi, menus, etc...) that has an executable but I those dont seem seem to work when ran.

I am wonding if only running qmake and make in the mainwindows folder is all I have to do?

Or do I need to go into every subfolder and run qmake and make?

wysota
15th April 2007, 16:01
"mainwindows" contains a set of examples in subdirectories. You need Qt libraries to be accessible to run them. Either place Qt libs in a path where your system looks for dlls (like C:\WINDOWS\System) or copy them to the same directory where each executable resides. Then you'll be able to run them.

Seth
15th April 2007, 16:11
Wysota, okay went into C:\Qt\4.2.3\lib and opended up the README file.

The README file says "If this directory is empty, you probably forgot to compile the Qt library." My README directory (file) is empty. Is this a cause of my problems? If so, how do I compile the Qt Libraries?