Getting syntax error in tutorial
-
in my Qt Creator everythink from this tutorial works, and i don't see any mistakes in code.
-
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. -
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.
-
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...
-
[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 -
[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.
-
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.
-
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.
-
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:-)
-
[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?
-
Qt Creator 2.1 RC is available "here":http://qt.nokia.com/developer/qt-qtcreator-prerelease/.
-
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
-
Open any .pro-file that you have not opened in Creator before.
-
[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.
-
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 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?
-
[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.