views:

3312

answers:

4

I am trying to use Qt for a project in school but am running into problems. I started following the tutorials and I am running into Makefile problems. Most of the tutorials say to run qmake -project, then qmake and finally make. But when I try this I run into the error make: *** No targets specified and no makefile found. Stop. I dont know much about Makefiles really. Could someone help point me in the right direction?

+1  A: 

It sounds like there might be a problem with your Qt install. Did you build it yourself, or install a build from someone else? Also, do you have an example .pro file that is giving you this trouble?

Arcane
I didn't build it myself. I installed the mac os x build from the qt site. the .pro i am using looks something like this:`TEMPLATE = appTARGET = DEPENDPATH += .INCLUDEPATH += .# InputHEADERS += hello.hSOURCES += hello.cpp main.cpp`
Sam
As others have pointed out, qt on OSX with the install from QtSoftware generates Xcode project files. You might want to try building your own Qt from source, so that it will default to building makefiles.
Arcane
+1  A: 

It's been a little while, but I think your problem is that qmake on Mac OS X creates xcode project files by default, instead of makefiles. That's why no makefile was found when you ran make. Instead, look in the command lines for qmake to specify how to target makefiles. Also, there might be an option you can add to the .pro file to force a makefile output every time.

Caleb Huitt - cjhuitt
+2  A: 

qmake on OS X creates Xcode project files. You can create a Makefile with:

qmake -spec macx-g++

If you don't want the Makefile to create an app bundle, you could also remove 'app_bundle' your configuration, for example by adding the following lines to your project file.

mac {
  CONFIG -= app_bundle
}
danieldk
+2  A: 

As other posters have pointed out, the default behavior of qmake on the Mac is to create xCode project files. You can type in something special every time you run qmake or add a few lines to each project file. There is a more permanent solution. I run into this every time I install Qt on my Mac. From a command line type in the following:

cd /usr/local/Qt4.5/mkspecs/

sudo rm default

sudo ln -sf macx-g++ default

The directory specified in the first online command may need some tweaking. The first "sudo" will require an administrative password.

What this does is remove the offending file that specifies that the default -spec switch is mac-xcode or something like that. We then replace it with a file specifying we use the macx-g++ switch by default.