
Originally Posted by
VireX
So you're wrong, considering I have been using it in my C++ program for years.
No, I'm not, it's still a C lib. You can use C libs in C++, you can't use C++ libs in C, therefore WinAPI is C and not C++ as I can write a C app that uses WinAPI.
Hey, maybe you forgot C and C++ are basically the same language, except C++ has OO functionality and a few other things.
*basically* and *few other things* are the key words here. They are different languages.
Which is why I said Compilable, not compatible.
Sorry, I might have misread what you wrote.
Because of the Q_OBJECT disadvantage in Qt.
Q_OBJECT is a macro which expands to some code and additionally serves as a marker for moc to know which classes it should process and for qmake to know which files to call moc for.
Well if I used DevC++ only it won't work with Q_OBJECT unless I manually add stuff after using moc.exe. Since I can only do it manually,
Manually? Oh man... can't you just compile the file moc spits out?
the easiest way is to use qmake,
Here I can agree with you.
which doesn't seem to work,
Here I can't. You're the first person on this forum who complains that "qmake doesn't work".
or the documentation is bad,
Did you actually read it or is this just an assumption? AFAIR the docs clearly say what qmake does and why.
or no one here can explain it.
Ask a specific question and you'll get an answer, either from me or someone else.
I call it forcing because, it is as if it was made to aggressively encourage you to only use qmake.
Actually you can use CMake instead of qmake. It works flawlessly as well, it's just a bit harder to write a working project file, but I'm sure our wiki can help you.
It works fine, until you decide to use slots signals.
Actually we were using signals and slots quite often. The only problems we had were the ones caused either by VS (I hate the debug and release folders used for the building process), bad habits (non-lowercase file naming) or the Windows platform itself.
Maybe so, but why would I use make, when I can just press build and let the program do it for me?
Make is exactly such a button, just "pressed" from the cmdline. I'm sure you can configure DevC++ to call "make" to build the project. It will even call qmake for you if the project file is changed.
Regardless, it doesn't compile, so either qmake is at fault for not setting the settings right, or make doesn't know how to compile qt code.
qmake and make don't compile code... They are both tools which are part of the build process, but it's the compiler that does the compilation. When you call qmake, it generates a Makefile suited for your compiler. Then a call to make will result in the Makefile being processed and one or a series of calls to different tools (compiler, linker or any other tools you find fit) will be made. You can use make to supervise any batch processing where it is possible to judge whether a particular action is required or not based on timestamps (that's basically all make does).
And I did this, it didn't work.
I tend to like to know someone means by "doesn't work" - I can find more accurate solutions then as I don't have to guess and ask for elaborations.
As I told you the error and no one could figure it out.
Oh yes. "Mr Mechanic, my car is broken because the engine doesn't start!"
My guess about your problem is that you have a faulty environment - either a wrong compiler takes precedence when qmake is called or something else in the variables is broken. When we started to ask you for specific information, you started calling "craps". So instead of you having resolved your issue we're here talking about qmake.
I got a few thousand errors even though compile/build buttons work fine, meaning qmake made a bad project file or make file.
Did you by any chance think that you might have misconfigured something? I have used that chain and it always worked.
Was there a mistake somewhere?
Obviously there was, as something didn't work 
In wxWidgets, they had event tables, and it didn't require this "extra" step. It wasn't that bad in pure Win API either (...) Why did they make it this way?
I suggest you actually take a look at a file moc generates. If you manage to do the same with C preprocessor, I'm sure Trolltech will be interested in buying that solution from you.
Was it to make it harder on people, or they just ran out of better ideas or what?
No, it was to have a fast and error-safe way of implementing object introspection and signals.
IF anything, why isn't there a tool that automatically does this while using DevC++ or Visual Studio.
There is, it's called make or "visual studio integration" respectively...
I would assume any newbie like me, that just learns Qt and signals/slots will have this trouble
Actually you're really the first person complaining about it on this board. There have been complains about qmake but they were caused by its incorrect use and people were satisfied when it was pointed out to them.
Luckily I came on this board and found out all about this "moc" thing.
"moc" stands for "meta-object compiler". Maybe it'll help you understand what it does (a hint - when you don't use meta-objects, you don't need it).
It's a hassle, so whatever, that is what I do now, manually use moc.
To be honest I think I called moc manually maybe once or twice in my life when I was experimenting with its command line arguments (and now I don't even remember if it has any that make it worth changing the default qmake call, which by the way you can do from within qmake project file, so there is really no reason to call moc by hand).
Ok of course there is qmake, so I tried using Qmake only to struggle for hours because mingw32-make will not compile the stuff that qmake created for me.
From what I've seen, you didn't use mingw32-make when starting this thread.
So why won't make work if qmake is tested and perfected?
Nothing is perfect and qmake complies with that statement. Why doesn't it work? Probably because you are using a port of make which is not compatible with qmake. qmake expects a GNU-make compatible version of make. BSD-make, GNU-make, mingw-make (which is a port of GNU-make) and nmake satisfy that condition. The version of make shipped with MinGW (or MSYS? I don't know, sorry...) doesn't.
I posted the pro file, doesn't seem wrong to anyone since I heard no objections.
The project file is correct.
So what is your advice now?
First stop using the word "crap". Then call your make with "-v" parameter to check what kind of make it is. For example mine returns (among other info) "GNU Make 3.81". Then make sure you're using the version of make that belongs to the mingw32-make package. Then rerun qmake (just in case) and run mingw32-make. If it doesn't work, post the errors and version of qmake and make you used. Then we'll think how to help you further.
qmake is three quick steps:
qmake -project
qmake
make
Actually the first step is optional and should be used only once when creating a project.
using moc manually (3 long steps):
Use moc.exe to interpret your files.
copy that code into your main cpp file.
Compile again.
How about (defines and include paths omitted for clarity):
moc mainwindow.h -o moc_mainwindow.cpp
g++ -c moc_mainwindow.cpp
g++ *.o -o myapp
moc mainwindow.h -o moc_mainwindow.cpp
g++ -c moc_mainwindow.cpp
g++ *.o -o myapp
To copy to clipboard, switch view to plain text mode
Of course, this could have been even easier if they hadn't required moc, or there was a DevC++ project setting that did all this for me.
Why do you blaim qmake then if your development environment lacks some option? If you don't like it then change it to some other IDE...
Are you sure? make does the compiling, qmake gets the makefile ready.
Yes, I'm sure. Make is an interpreter for a compilation script. It doesn't modify any file itself.
I use mingw32 and DevC++. If make doesn't do compiling, why would it give errors about my files like as if it does compiling?
Because it encounters errors in the script fed to it.
No one asked me the exact name of the compiler in this post.
You were asked about the version of make used.
AFAIK DevC++ is an IDE.
Which is common knowledge that it uses mingw32 compiler.
It will use whatever you configure it to use.
I don't use borland. but if I type make only, a borland make interferes, I don't know how to remove that.
Either delete it from your system, rename it, put it behind mingw-make in the %PATH% (and rename mingw32-make to make) or call mingw32-make explicitely.
You used an incorrect tool (Borland make) to build your project.
It compiles fine with DevC++ meaning,
It probably calls a correct make version or doesn't use make at all (I think there is a plugin for DevC++ that handles Qt projects).
qmake has the wrong settings for some reason right?
It is possible, but it's more probable that a wrong make is used. And if qmake settings are indeed wrong, then all that may be wrong is that your toolchain (make) may be guessed incorrectly.
Bookmarks