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.4k 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.
  • T Offline
    T Offline
    tobias.hunger
    wrote on last edited by
    #6

    Do you get an error when building? When I used eclipse ages ago it did not understand the signal/slot mechanism in Qt:-( Better use Qt Creator...

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

      Hi, Tobias -

      No, no error when building. I probably should ignore it, but I like to understand stuff like this. I would use Qt Creator, but I'm going to need an IDE eventually, so I'd like to try to get this resolved.

      1 Reply Last reply
      0
      • D Offline
        D Offline
        dangelog
        wrote on last edited by
        #8

        Then it's likely to be eclipse not recognizing Qt keywords.

        Software Engineer
        KDAB (UK) Ltd., a KDAB Group company

        1 Reply Last reply
        0
        • ZlatomirZ Offline
          ZlatomirZ Offline
          Zlatomir
          wrote on last edited by
          #9

          [quote author="mzimmers" date="1295023042"]...but I'm going to need an IDE eventually...[/quote]
          "Qt Creator":http://qt.nokia.com/products/developer-tools/ is an IDE, a multi-platform, fast, very nice IDE

          https://forum.qt.io/category/41/romanian

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

            [quote author="Zlatomir" date="1295023281"]"Qt Creator":http://qt.nokia.com/products/developer-tools/ is an IDE, a multi-platform, fast, very nice IDE
            [/quote]

            OK...I guess I should take a closer look at it.

            Do you know of any tutorials that focus on learning the tools, rather than learning Qt per se? The tutorials I'm doing now are interesting, but I don't think I'm learning much about the development tools.

            Thanks.

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

              I am not aware of any specific tutorials, but there was a presentation about "Getting the most out of Qt Creator" at the devdays. The video is available "here":http://qt.nokia.com/developer/learning/online/talks/developerdays2010/tech-talks/getting-the-most-out-of-qt-creator.

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

                OK, thanks...I also found this after I asked the question:

                http://doc.qt.nokia.com/qtcreator-2.0.1/

                I'm just getting started in it, but it looks pretty good.

                I'll play with this for awhile and see how it works for me.

                Thanks again for the help.

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

                  That documentation is also available inside Qt Creator (In "Help" mode, Ctrl-6). 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:-)

                  1 Reply Last reply
                  0
                  • 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