Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Getting syntax error in tutorial
Forum Updated to NodeBB v4.3 + New Features

Getting syntax error in tutorial

Scheduled Pinned Locked Moved General and Desktop
25 Posts 6 Posters 13.8k 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.
  • mzimmersM Offline
    mzimmersM Offline
    mzimmers
    wrote on last edited by
    #14

    [quote author="Tobias Hunger" date="1295031962"]That documentation is also available inside Qt Creator (In "Help" mode, Ctrl-6).[/quote]

    Yeah, I know, but...it's kind of hard to switch back and forth between the in-application documentation, and the views that I actually use to do the work. It's easier just to read the documentation from a browser. (I have two displays.)

    [quote]I'd recommend upgrading to Qt Creator 2.1 RC. It is very close to what will get released as 2.1 soonish (we hope) and has quite some improvements:-)[/quote]

    I'm willing to give that a try; where do I find it? Is it available for Mac?

    1 Reply Last reply
    0
    • T Offline
      T Offline
      tobias.hunger
      wrote on last edited by
      #15

      Qt Creator 2.1 RC is available "here":http://qt.nokia.com/developer/qt-qtcreator-prerelease/.

      1 Reply Last reply
      0
      • mzimmersM Offline
        mzimmersM Offline
        mzimmers
        wrote on last edited by
        #16

        OK...it seems to be running. I'll play with it some more tomorrow.

        In the meantime (and I know the answer is right in front of me), how do I get to the window in step 2 of this page?

        "creator example":http://doc.qt.nokia.com/qtcreator-2.0.1/creator-build-example-application.html

        1 Reply Last reply
        0
        • T Offline
          T Offline
          tobias.hunger
          wrote on last edited by
          #17

          Open any .pro-file that you have not opened in Creator before.

          1 Reply Last reply
          0
          • mzimmersM Offline
            mzimmersM Offline
            mzimmers
            wrote on last edited by
            #18

            OK, but...what about when creating a brand-new project? The tutorial shows a dialog box for selecting tagets that I can't find. I'm sure it's right under my nose, but...I can't figure out how to get to it.

            1 Reply Last reply
            0
            • mzimmersM Offline
              mzimmersM Offline
              mzimmers
              wrote on last edited by
              #19

              [quote author="mzimmers" date="1294951724"]Hi -

              I'm getting a syntax error on this line:

              @ connect(slider, SIGNAL(valueChanged(int)),
              lcd, SLOT(display(int)));
              @
              [/quote]

              I did a little playing around with this, and discovered that removing the of occurances of (int) in the code, and replacing them with something like (0) eliminated the error. Not sure what this means, but...it does seem odd that eclipse would give me an error on this.

              1 Reply Last reply
              0
              • T Offline
                T Offline
                tobias.hunger
                wrote on last edited by
                #20

                SIGNAL and SLOT are supposed to contain a signature of a method, so it must contain "int", not 0. Your changed code will not work: At runtime it will fail to connect the signal to the slot.

                1 Reply Last reply
                0
                • G Offline
                  G Offline
                  goetz
                  wrote on last edited by
                  #21

                  [quote author="mzimmers" date="1295229420"]OK, but...what about when creating a brand-new project? The tutorial shows a dialog box for selecting tagets that I can't find. I'm sure it's right under my nose, but...I can't figure out how to get to it.[/quote]

                  You do not find what - the dialog box or the targets within the dialog box?

                  http://www.catb.org/~esr/faqs/smart-questions.html

                  1 Reply Last reply
                  0
                  • mzimmersM Offline
                    mzimmersM Offline
                    mzimmers
                    wrote on last edited by
                    #22

                    [quote author="Tobias Hunger" date="1295258618"]SIGNAL and SLOT are supposed to contain a signature of a method, so it must contain "int", not 0. Your changed code will not work: At runtime it will fail to connect the signal to the slot.[/quote]

                    Oh, I realize that. The purpose of that exercise was to see whether I could eliminate the eclipse editor's "syntax error" message that I got. For whatever reason, the editor doesn't like the "int." No big deal, as the program builds and runs fine, but...I was hoping to get to the bottom of the error.

                    1 Reply Last reply
                    0
                    • G Offline
                      G Offline
                      goetz
                      wrote on last edited by
                      #23

                      SIGNAL() and SLOT() are actually macros that do some magic to convert the method signature into a const char array, that is actually fed to the connect method. Seems that eclipse does not recognize this fact and treats it as regular C/C++ syntax and bails out.

                      http://www.catb.org/~esr/faqs/smart-questions.html

                      1 Reply Last reply
                      0
                      • mzimmersM Offline
                        mzimmersM Offline
                        mzimmers
                        wrote on last edited by
                        #24

                        Interesting...are those macros explicitly defined in a .h file, or are they part of the Qt behind-the-scenes magic?

                        1 Reply Last reply
                        0
                        • G Offline
                          G Offline
                          goetz
                          wrote on last edited by
                          #25

                          The macros are defined in qobjectdefs.h of QtCore module. They must be defined in a .h file otherwise the compiler would bail out.

                          http://www.catb.org/~esr/faqs/smart-questions.html

                          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