Getting syntax error in tutorial
-
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.
-
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.