Results 1 to 4 of 4

Thread: Not declared in scope

  1. #1
    Join Date
    Aug 2014
    Posts
    11
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Not declared in scope

    The follow is a header file of a simple dialog generated with QCreator. On the two method/function definitions I get the following errors:

    QFXINFO has not be declared
    QIFT was not declared in this scope

    This is probably a c++ issue, but what am I doing wrong?

    Qt Code:
    1. #ifndef DIALOG_H
    2. #define DIALOG_H
    3.  
    4. #include <QDialog>
    5. #include <QList>
    6.  
    7. namespace Ui {
    8. class Dialog;
    9. }
    10.  
    11. class Dialog : public QDialog
    12. {
    13. Q_OBJECT
    14.  
    15. public:
    16. explicit Dialog(QWidget *parent = 0);
    17. ~Dialog();
    18.  
    19. void readQFX(QString fileName, QFXINFO qfxInfo, QList<QIFT> qifTL);
    20. void writeQIF(QString filename, QFXINFO qfxInfo, QList<QIFT> qifTL);
    21.  
    22.  
    23. private:
    24. Ui::Dialog *ui;
    25.  
    26. // Define a QIF transaction
    27. struct QIFT
    28. {
    29. QString cleared; // value = C* set by program for all trans.
    30. QString date; // value form qfx <DTPOSTED>
    31. QString memo; // taken from qfx <NAME>
    32. QString ckNum; // taken from qfx <CHECKNUM>
    33. QString amt; // taken from qfx <TRNAMT>
    34. };
    35.  
    36. QList<QIFT> qifTL; // list of QFX2QIF transactions
    37.  
    38. // Define QFX info record
    39. struct QFXINFO
    40. {
    41. QString org; // value = (C1 for Capital One for example).
    42. QString type; // value = bank or credit card
    43. QString startDate; // transaction start date
    44. QString stopDate; // transaction stop date
    45. };
    46.  
    47. QFXINFO qfxInfo;
    48.  
    49.  
    50.  
    51. private slots:
    52. void on_donePB_pressed();
    53. void on_QFXSourcePB_pressed();
    54. void on_saveFolderPB_pressed();
    55. void on_reformatePB_pressed();
    56.  
    57. };
    58.  
    59. #endif // DIALOG_H
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Not declared in scope

    You did not include header files for the two types.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Aug 2014
    Posts
    11
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Re: Not declared in scope

    wysota, Thanks for the reply. It seems the compiler did not like the structs being private and the function defs using them public. I made the structs public and it compiled - same if I made all private. Makes sense.
    Mike

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Not declared in scope

    Oh, I didn't notice these types were private internal classes of your class.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. 'fileMenu' was not declared in the scope
    By lapdx in forum Newbie
    Replies: 5
    Last Post: 6th December 2012, 22:16
  2. endl' was not declared in this scope
    By k.qasempour in forum Newbie
    Replies: 8
    Last Post: 21st June 2012, 09:36
  3. ui not declared in scope
    By steve.bush in forum Newbie
    Replies: 5
    Last Post: 19th March 2011, 08:58
  4. QDomDocument was not declared in this scope
    By grantbj74 in forum Newbie
    Replies: 5
    Last Post: 25th August 2009, 09:43
  5. Replies: 2
    Last Post: 28th December 2007, 18:30

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.