Includes not found



  • OK but where does it say (Qt documentation) that the following will give inclusion errors

    @
    #ifndef LOTTERY_H
    #define LOTTERY_H

    #include <QtGui/QWidget>
    #include "ui_lottery.h"
    #include <QMap>
    #include <QPaintEvent>
    #include <iostream>...........................................// unresolved inclusion
    #include <fstream>...........................................// unresolved inclusion
    //using namespace std;
    ofstream fout("/home/qt4user/landon.txt");......// ofstream could not be resolved
    class Lottery : public QWidget
    {
    Q_OBJECT

    public:
    Lottery(QWidget *parent = 0);
    ~Lottery();

    private:
    Ui::LotteryClass ui;........................................// Ui::LotteryClass could not be resolved
    void paintEvent( QPaintEvent * );
    QMap<int,int> histo;
    QPaintEvent* qpaintevent;
    void drawShapes( QPainter *p );
    private slots:
    void selectClicked();
    };

    #endif // LOTTERY_H
    @

    [EDIT: please wrap code in @-tags, Volker]



  • Some administrative remarks first:

    • I split off your question off "this older thread":/forums/viewthread/12088 where you had posted it first. Please do not add new questions to old threads, especially in case they are marked "solved" already
    • please wrap your code in @-tags, this way it is formatted nicely

    #including iostream and fstream shouldn't lead to any errors. Try with a simple main method only, without any Qt related stuff to double check this.

    If your Ui::LotteryClass is not known, check in the designer if your form is named LotteryClass.



  • bq. OK but where does it say (Qt documentation) that the following will give inclusion errors

    Why would you expect the Qt documentation to tell you how why your compiler pre-processor does not find standard C++ headers? This has nothing to do with Qt.

    As for Ui::LotteryClass, that's dependent on the include file ui_lottery.h generated from your lottery.ui file. Since the pre-processor finds ui_lottery.h it is clear that the top object defined in your UI is not call LotteryClass.



  • I'm sorry but what are @-tage???



  • guessing @-tags

    @source
    lda
    sta
    x=y
    @source


  • Moderators

    You simply place a single @ character on the line immediately before and immediately after a block of code. That forces the code to be formatted differently. If you hit edit on your initial post, you can see how Volker inserted them around your code block above.


  • Moderators

    There is also some description in the "forum help":http://qt-project.org/wiki/ForumHelp#e3f82045ad0f480d3fb9e0ac2d58fb01


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.