Error in building -every- project with the Qt Creator
-
I'm having trouble compiling from the command line...
- Opened up the "Qt 4.7.3 for Desktop (MinGW)
- Wrote a small C++ file:
@
#include <QApplication>
#include <QLabel>int main(int argc, char **argv) {
QApplication app(argc, argv);
QLabel *qlbl = new QLabel("Testing");
app.setMainWidget(qlbl);
qlbl->show();return app.exec();
}
@- Followed along these instructions:
http://www.developer.nokia.com/Community/Wiki/How_to_Compile_Qt(.cpp)_file_from_command_prompt
But the command prompt does not recognize the make command.
Am I doing something wrong..?
-
Did you use mingw-make? Or just make?
-
Tried both, actually...
Well, maybe MinGW screws everything up...
What if I'll download the latest version of MinGW from their website, and somehow get Qt Creator to use that version?Is that even possible?
-
Yes, Qt Creator can use custom mingw installations: Go to Tools->Options->Tool chains and add a new Mingw tool chain. There is documentation on how to do that exactly available in the Qt Creator manual. It is really informative, I can highly recommend spending some time skimming over it:-)
-
Tobias - I have added the MinGW that I've installed using the "official" MinGW installer. I have specified the path to the compiler, and the debugger path was automatically added by Qt.
Something is odd - I've told Qt to install it's own MinGW (located inside the QtSDK folder), yet Qt uses my MinGW that was INSTALLED EARLIER using the MinGW installer. Maybe THAT is causing the problem!
So, I try to remove the automatically detected MinGW, but I can't - the "Remove" button remains disabled.
So, how should I tell Qt to use the MinGW that was installed with it?
-
Any help..?
-
Is it possible that there are remainings of your old MinGW installation left in the environment variables (especially PATH) or the registry?
-
Lukas - I have remove the Old MinGW from the PATH and physically from the Hard-Drive.
I've re-installed Qt and verified that Qt is using the MinGW inside the Qt directory (which it does).However, it appears to be worse - now when I run a Qt example in the Qt Creator startup screen, the compilation yields 100 errors and 97 warnings... The same errors it gave me when it was using the old MinGW (see a couple of posts above).
What's going on here..?
-
Try adding -U__STRICT_ANSI__ to your compiler flags.
-
Lukas, sorry for the stupidity, but how exactly do I do that? I'm compiling from the IDE and I haven't seen such option in the Options dialog. Can you please tell me how to do that?
-
Try installing Qt on other windows 7, and check if it works, because it worked fine for me. And I'm using windows 7 professional x86.
There might be some kind of problems with your system.
You know windows reinstall is the mighty solution for everything :D
-
xcoder - I don't have another Windows 7 machine, and I can't (and won't, for that matter) re-install my current operating system.
Trust me, I know that re-installing Windows is like a magic troubleshooting solution. However, I'm not going to get into the mess of re-installing Windows and all the programs I have (and backup all of my digital music library) just to get a piece of software to work. A software that is, as far as I can tell, doesn't work because a peculiar reason.
Sorry, but that solution is irrelevant. As much as I would like to stay away from any Microsoft crap like MFC or WinAPI, I can't waste time trying to figure out why am I getting a hundred errors for no reason.
I would appreciate any other solutions, if there are any.
-
I still bet that your MinGW installation is broken due to a corrupted environment.
Open a command promt, unset all environment variables (especially PATH, INCLUDE, LIB, QTDIR, QMAKESPEC) and then execute qtvars2.bat from the Qt SDK directory to get a fresh Qt environment.
As for STRICT_ANSI just add @ #undef STRICT_ANSI @ at the top of your source file (normally this is not needed and if it works afterwards it is most likely that something is still broken).
-
Lukas - I don't have the qtvars2.bat file in my Qt SDK directory. I only have qtenv.
-
[quote author="ElectroRonen" date="1311686387"]Lukas - I don't have the qtvars2.bat file in my Qt SDK directory. I only have qtenv.[/quote]
Should do the same.