February 19, 2011

rosh1985 rosh1985
Lab Rat
2 posts

[Solved]Forbidden Declaration…

 

Hi all,

I’m relatively new to Qt C++ programming, and as such I have been following the tutorial “Address Book” on this website (using linux). I have completed the code, and the only errors i get when debugging are “ISO C++ forbids declaration “FindDialog” with no type” and “expected ‘;’ before (*) token”.

the snippet of code this is referring to is in addressbook.h, in particular the line;

private:

FindDialog *dialog;

i’m totally sure of why i get these errors, I have followed the tutorial, and the rest of the code up to this point is fine from what i can see. I tested it at the completion of each section, and this is where the first error came up. Numourous other errors were present but i was able to work out why and fixed them (not declared etc)

Greatly appreciate any help with this!
Thanks!

3 replies

February 19, 2011

Gerolf Gerolf
Area 51 Engineer
3210 posts

Where is FindDialog defined?

I think, there are two solutions to that (if it is the problem I think):

  1. include the header file of FindDialog in your header
  2. make a pre definition in your header at the top:
    1.     class FindDialog;
 Signature 

Nokia Certified Qt Specialist.
Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

February 19, 2011

rosh1985 rosh1985
Lab Rat
2 posts

thanks for the reply, I have managed to work out my issue not long ago just before your comment, i did basically what you said here.

i had missed the inclusion of the Find Dialog header file in my other header file that was using the private reference of FindDialog *dialog.

Rooky mistake, but thats how we learn.

Thanks for getting back to my comment, much appreciated!

February 19, 2011

Gerolf Gerolf
Area 51 Engineer
3210 posts

Hi rosh1985,

as your problem is solved, please mark this thread as solved:
click on your first posts’ edit link, change the title and add [Solved] in the beginning, so everybody knows, it’s done.

Thanks.

 Signature 

Nokia Certified Qt Specialist.
Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

 
  ‹‹ [Solved] Duplicate finder      Qt Charting Component - Feedback request ››

You must log in to post a reply. Not a member yet? Register here!