tags:

views:

144

answers:

2

Hi, I'm starting to learn Qt and I'm stuck on particular step, which is: I cannot create executable file. My steps are as follows:

  1. Creation of *.cpp
  2. In console typing qmake -project (this creates .pro file)
  3. In console typing qmake -makefile (now I have makefile + some other files)
  4. I'm trying to create .exe by typing qmake but this isn't working. I've also tried nmake, bmake and make but no results.

Any help will be appreciated. Thank you.

+3  A: 

It depends on what compiler you are using. If you're using GCC or MinGW, type make. If make cannot be found, either it is not installed, or it's not in your path (more likely to be the case). Try using the command prompt shortcut Qt provides you (if on Windows). If on a POSIX-based/-like system, make should exist. If it doesn't, then it depends if you're on a Mac or on Linux/BSD. On a Mac, make should come with the developer tools, which is one of the last CDs in the OS X installation CDs. If you're on Linux, use your package manager. rpm for Red Hat based systems, apt for Debian based systems, and so on. Google about them.

If you're using Visual C++ and nmake doesn't work, it could mean that nmake isn't on your path. Try using the Visual C++ command prompt instead of the normal command prompt (should be somewhere in your start menu).

It would be more helpful if you could mention how you installed Qt, and on what system.

blwy10
+1 "but no results" is a bit vague, isn't it? There's usually *a result*...error messages, things like that. :)
Hostile Fork
@Hostile Fork - When I'm saying "no results" it means: no results. If there would happened anything I would list it. And what's vague about "no results"? How else shal I say that nothing has happened?
There is nothing we can do
From looking at the tags that @atch is following I see a visual studio tag.
David Glass
Actually, yes, I just realised, what does "no results mean". The only way for there to be absolutely nothing printed is if make exists, and make is very chatty, so it's not likely that you invoke make and make doesn't say something.
blwy10
@blwy10 - I installed Qt by executing exe file downloaded from Qt site. I'm using Windows 7. I'm not using Visual Studio for this purpose. I hope this help. Looking forward to your answer.
There is nothing we can do
@atch, do you mean no output files like exe files or object files? no output at the command line? or both? No results can mean anything, because a result can be anything.
blwy10
@atch Which exe file? The full SDK? The one with Qt only? And for which compiler? I assume you want to use MinGW; did you install the Qt package for MinGW?
blwy10
Yes, when I type qmake after all this steps I've listed no output files are generated and console is in state as it was from before I executed qmake. For example, if I had something like this in console: C:\Users\Arthur\Documents\Qt\Projects> then I've typed qmake and pressed enter output in console is: C:\Users\Arthur\Documents\Qt\Projects>.
There is nothing we can do
@blwy10 to be honest I don't remember which file I downloaded. Maybe I should try download and install full SDK? What are you thinking?
There is nothing we can do
qmake is less chatty than make. When qmake runs without errors it doesn't say anything. qmake is a Makefile generator; when you type qmake and nothing else, and it doesn't say anything, it has successfully generated your Makefile. Given that qmake is on your path, make will be on your path. So type make, and it should compile. If not, try mingw32-make.
blwy10
@atch Which compiler are you using? MinGW right? Do you have MinGW installed?
blwy10
@blwy after mingw32-make it created .o and .exe but when I try to execute .exe I'm getting error: "The program can't start because libgcc_s_dw2-1.dll is missing from your computer. Try reinstalling the program to fix this problem". Any idea why this happens?
There is nothing we can do
@blwy10 I found this file (libgcc_s_dw2-1.dll) in c:\qt\2009.05\mingw\bin. I wonder why I'm getting the error I mentioned previously?
There is nothing we can do
Because c:\qt\2009.05\mingw\bin is not in your path. In order for a program to find the DLL it needs, the DLL must either be in the same folder as the program, or the folder the DLL is in must be on the path. Use dependency walker to determine what DLLs you need, and then search your computer for them. A good search tool for files is locate32.
blwy10
A: 

I believe you need to do something like:

qmake -o Makefile hello.pro

Then type make or nmake depending on the compiler you use.

David Glass
This doesn't work.
There is nothing we can do