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.
  • M Offline
    M Offline
    mzimmers
    wrote on 13 Jan 2011, 20:48 last edited by
    #1

    Hi -

    I'm trying to run through the tutorials on trolltech, and am currently looking at this one:

    "tutorial 5":http://doc.trolltech.com/4.3/tutorial-t5.html

    (I'm doing this in eclipse, by the way.)

    I'm getting a syntax error on this line:

    @ connect(slider, SIGNAL(valueChanged(int)),
    lcd, SLOT(display(int)));
    @

    Can someone tell me what's going on here? I don't know enough about connect yet to debug this on my own.

    Thanks.

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dangelog
      wrote on 13 Jan 2011, 21:00 last edited by
      #2

      And the error is?

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

      1 Reply Last reply
      0
      • B Offline
        B Offline
        BlackDante
        wrote on 13 Jan 2011, 21:03 last edited by
        #3

        in my Qt Creator everythink from this tutorial works, and i don't see any mistakes in code.

        sorry for my broken english :)

        1 Reply Last reply
        0
        • G Offline
          G Offline
          goetz
          wrote on 13 Jan 2011, 22:00 last edited by
          #4

          The "Signals & Slots":http://doc.trolltech.com/stable/signalsandslots.html has some good explanations.

          EDIT:
          The tutorial you linked to is quit outdated. It's from version 4.3, current is 4.7. You can find the recent tutorials "here":http://doc.trolltech.com/stable/tutorials.html.

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

          1 Reply Last reply
          0
          • M Offline
            M Offline
            mzimmers
            wrote on 13 Jan 2011, 23:12 last edited by
            #5

            Volker: thanks for the link. I'd like to finish these up, though, since I'm halfway through.

            Peppe: I don't get anything more specific than simply "syntax error"...I did try building it, and it builds without an error or warning, so now I'm really confused. I wonder if there's some invisible character that I accidentally copied and pasted in with the code. Not sure what to do at this point; maybe this is more an eclipse problem than a Qt problem.

            1 Reply Last reply
            0
            • T Offline
              T Offline
              tobias.hunger
              wrote on 14 Jan 2011, 06:43 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
              • M Offline
                M Offline
                mzimmers
                wrote on 14 Jan 2011, 16:37 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 14 Jan 2011, 16:39 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
                  • Z Offline
                    Z Offline
                    Zlatomir
                    wrote on 14 Jan 2011, 16:41 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
                    • M Offline
                      M Offline
                      mzimmers
                      wrote on 14 Jan 2011, 18:13 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 14 Jan 2011, 18:58 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
                        • M Offline
                          M Offline
                          mzimmers
                          wrote on 14 Jan 2011, 19:02 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 14 Jan 2011, 19:06 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
                            • M Offline
                              M Offline
                              mzimmers
                              wrote on 14 Jan 2011, 19:15 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 14 Jan 2011, 20:29 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
                                • M Offline
                                  M Offline
                                  mzimmers
                                  wrote on 15 Jan 2011, 04:26 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 15 Jan 2011, 07:49 last edited by
                                    #17

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

                                    1 Reply Last reply
                                    0
                                    • M Offline
                                      M Offline
                                      mzimmers
                                      wrote on 17 Jan 2011, 01:57 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
                                      • M Offline
                                        M Offline
                                        mzimmers
                                        wrote on 17 Jan 2011, 02:00 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 17 Jan 2011, 10:03 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

                                          1/25

                                          13 Jan 2011, 20:48

                                          • Login

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