Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Problem compiling Qt example from OS X terminal
Qt 6.11 is out! See what's new in the release blog

Problem compiling Qt example from OS X terminal

Scheduled Pinned Locked Moved Qt Creator and other tools
11 Posts 3 Posters 9.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #2

    Your include paths are not set correctly. Can you paste the hello.pro and the hello.cpp here (use the @-Tags or the button to pretty format the code).

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #3

      The Following is the hello.pro
      @######################################################################

      Automatically generated by qmake (2.01a) Sat Nov 6 15:35:50 2010

      ######################################################################

      TEMPLATE = app
      TARGET =
      DEPENDPATH += .
      INCLUDEPATH += .

      Input

      SOURCES += hello.cpp@

      The following is the hello.cpp
      @#include <QApplication>
      #include <QLabel>

      int main(int argc, char *argv[])
      {
      QApplication app(argc, argv);
      QLabel *label = new QLabel("Hello Qt!");
      label->show();
      return app.exec();
      }
      @

      1 Reply Last reply
      0
      • ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #4

        Your qmake seems to be setup to create XCode project files (that creates the file hello.xcodeproj). You should try

        @
        rm -rf hello.xcodeporj
        rm Info.plist

        qmake -spec macx-g++
        @

        That removes the XCode project files and creates a normal makefile for you.

        1 Reply Last reply
        0
        • ? Offline
          ? Offline
          A Former User
          wrote on last edited by
          #5

          Worked perfectly! Thanks so much!

          1 Reply Last reply
          0
          • ? Offline
            ? Offline
            A Former User
            wrote on last edited by
            #6

            You're welcome.

            Just for curiosity: How did you install Qt? The default mode for qmake is generating a makefile, not an xcode project, as far as I know.

            1 Reply Last reply
            0
            • D Offline
              D Offline
              DenisKormalev
              wrote on last edited by
              #7

              Volker, I've stucked with same problem when ported one of my projects to MacOSX. Qt was installed from package from qt ftp. I think that setting QMAKESPEC will help, but didn't try (always explicitly setted -spec param to qmake).

              1 Reply Last reply
              0
              • ? Offline
                ? Offline
                A Former User
                wrote on last edited by
                #8

                Ah, I see. I've always compiled the libs manually, there the default is normal makefiles.

                You can change the default: Go to the installation directory of Qt, enter the mkspecs directory and change the symbolic link default to macx-g++, that should work.

                1 Reply Last reply
                0
                • D Offline
                  D Offline
                  DenisKormalev
                  wrote on last edited by
                  #9

                  Volker, yeah, another good way :)

                  1 Reply Last reply
                  0
                  • ? Offline
                    ? Offline
                    A Former User
                    wrote on last edited by
                    #10

                    Once in a while one forgets the -spec switch and gets the wrong proejct files :)

                    1 Reply Last reply
                    0
                    • ? Offline
                      ? Offline
                      A Former User
                      wrote on last edited by
                      #11

                      I installed Qt 4.7.0, Qt Creator 2.0.1, and Xcode Developer 3.1.3.

                      All of them were installed from disk images.

                      I didn't install any of them manually.

                      1 Reply Last reply
                      0

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved