Results 1 to 11 of 11

Thread: cant make program run C++ gui programming

  1. #1
    Join Date
    Jan 2010
    Posts
    63
    Qt products
    Qt4
    Platforms
    Windows

    Unhappy cant make program run C++ gui programming

    I get tons of erros for ant make program run C++ gui programming on page 31. I entered the whole program perfectly .
    Here it is
    finddialog.h
    001 #ifndef FINDDIALOG_H
    002 #define FINDDIALOG_H
    003 #include <QDialog>
    004 class QCheckBox;
    005 class QLabel;
    006 class QLineEdit;
    007 class QPushButton;
    008 class FindDialog : public QDialog
    009 {
    010 Q_OBJECT
    011 public:
    012 FindDialog(QWidget *parent = 0);
    013 signals:
    014 void findNext(const QString &str, Qt::CaseSensitivity cs);
    015 void findPrevious(const QString &str, Qt::CaseSensitivity cs);
    016 private slots:
    017 void findClicked();
    018 void enableFindButton(const QString &text);
    019 private:
    020 QLabel *label;
    021 QLineEdit *lineEdit;
    022 QCheckBox *caseCheckBox;
    023 QCheckBox *backwardCheckBox;
    024 QPushButton *findButton;
    025 QPushButton *closeButton;
    026 };
    027 #endif

    finddialog.cpp
    001 #include <QtGui>
    002 #include "finddialog.h"
    003 FindDialog::FindDialog(QWidget *parent)
    004 : QDialog(parent)
    005 {
    006 label = new QLabel(tr("Find &what:"));
    007 lineEdit = new QLineEdit;
    008 label->setBuddy(lineEdit);
    009 caseCheckBox = new QCheckBox(tr("Match &case"));
    010 backwardCheckBox = new QCheckBox(tr("Search &backward"));
    011 findButton = new QPushButton(tr("&Find"));
    012 findButton->setDefault(true);
    013 findButton->setEnabled(false);
    014 closeButton = new QPushButton(tr("Close"));
    015 connect(lineEdit, SIGNAL(textChanged(const QString &)),
    016 this, SLOT(enableFindButton(const QString &)));
    017 connect(findButton, SIGNAL(clicked()),
    018 this, SLOT(findClicked()));
    019 connect(closeButton, SIGNAL(clicked()),
    020 this, SLOT(close()));
    021 QHBoxLayout *topLeftLayout = new QHBoxLayout;
    022 topLeftLayout->addWidget(label);
    023 topLeftLayout->addWidget(lineEdit);
    024 QVBoxLayout *leftLayout = new QVBoxLayout;
    025 leftLayout->addLayout(topLeftLayout);
    026 leftLayout->addWidget(caseCheckBox);
    027 leftLayout->addWidget(backwardCheckBox);
    028 QVBoxLayout *rightLayout = new QVBoxLayout;
    029 rightLayout->addWidget(findButton);
    030 rightLayout->addWidget(closeButton);
    031 rightLayout->addStretch();
    032 QHBoxLayout *mainLayout = new QHBoxLayout;
    033 mainLayout->addLayout(leftLayout);
    034 mainLayout->addLayout(rightLayout);
    035 setLayout(mainLayout);
    036 setWindowTitle(tr("Find"));
    037 setFixedHeight(sizeHint().height());
    038 }

    039 void FindDialog::findClicked()
    040 {
    041 QString text = lineEdit->text();
    042 Qt::CaseSensitivity cs =
    043 caseCheckBox->isChecked() ? Qt::CaseSensitive
    044 : Qt::CaseInsensitive;
    045 if (backwardCheckBox->isChecked()) {
    046 emit findPrevious(text, cs);
    047 } else {
    048 emit findNext(text, cs);
    049 }
    050 }
    051 void FindDialog::enableFindButton(const QString &text)
    052 {
    053 findButton->setEnabled(!text.isEmpty());
    054 }

    main.cpp
    001 #include <QApplication>
    002 #include "finddialog.h"
    003 int main(int argc, char *argv[])
    004 {
    005 QApplication app(argc, argv);
    006 FindDialog *dialog = new FindDialog;
    007 dialog->show();
    008 return app.exec();
    009 }


    One of the errors Isee is the build choking on #include <QtGui> I finf this happening in some of the demo programs too.
    I don't know how to fix this problem HELP !

  2. #2
    Join Date
    Jan 2010
    Posts
    18
    Thanks
    11
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: cant make program run C++ gui programming

    so what are the errors ?

    for better undrstanding please put your code between
    Last edited by gbmtoday; 14th January 2010 at 23:55.

  3. #3
    Join Date
    Jan 2010
    Posts
    63
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: cant make program run C++ gui programming

    Here is the list
    ----------------------------------------------------------------------------------------------------
    In file included from FindDialog.cpp:2:
    c:\Qt\2009.05\qt\include\QtGui/QtGui:7:31: error: qaccessibleobject.h: No such file or directory
    In file included from c:\Qt\2009.05\qt\include\QtGui/qaccessiblewidget.h:1,
    from c:\Qt\2009.05\qt\include\QtGui/QtGui:9,
    from FindDialog.cpp:2:
    c:\Qt\2009.05\qt\include\QtGui/../../src/gui/accessible/qaccessiblewidget.h:45:37: error: QtGui/qaccessibleobject.h: No such file or directory
    In file included from FindDialog.cpp:3:
    finddialog.h:49:2: error: #endif without #if
    In file included from c:\Qt\2009.05\qt\include\QtGui/qaccessiblewidget.h:1,
    from c:\Qt\2009.05\qt\include\QtGui/QtGui:9,
    from FindDialog.cpp:2:
    c:\Qt\2009.05\qt\include\QtGui/../../src/gui/accessible/qaccessiblewidget.h:58: error: expected class-name before '{' token
    c:\Qt\2009.05\qt\include\QtGui/../../src/gui/accessible/qaccessiblewidget.h:60: error: 'Role' has not been declared
    c:\Qt\2009.05\qt\include\QtGui/../../src/gui/accessible/qaccessiblewidget.h:64: error: 'Relation' does not name a type
    c:\Qt\2009.05\qt\include\QtGui/../../src/gui/accessible/qaccessiblewidget.h:68: error: 'RelationFlag' has not been declared
    c:\Qt\2009.05\qt\include\QtGui/../../src/gui/accessible/qaccessiblewidget.h:70: error: 'Text' has not been declared
    c:\Qt\2009.05\qt\include\QtGui/../../src/gui/accessible/qaccessiblewidget.h:71: error: 'Role' does not name a type
    c:\Qt\2009.05\qt\include\QtGui/../../src/gui/accessible/qaccessiblewidget.h:72: error: 'State' does not name a type
    c:\Qt\2009.05\qt\include\QtGui/../../src/gui/accessible/qaccessiblewidget.h:76: error: 'Text' has not been declared
    c:\Qt\2009.05\qt\include\QtGui/../../src/gui/accessible/qaccessiblewidget.h:60: error: 'Client' was not declared in this scope
    c:\Qt\2009.05\qt\include\QtGui/../../src/gui/accessible/qaccessiblewidget.h:98: error: expected class-name before '{' token
    c:\Qt\2009.05\qt\include\QtGui/../../src/gui/accessible/qaccessiblewidget.h:100: error: 'Role' has not been declared
    c:\Qt\2009.05\qt\include\QtGui/../../src/gui/accessible/qaccessiblewidget.h:104: error: 'Relation' does not name a type
    c:\Qt\2009.05\qt\include\QtGui/../../src/gui/accessible/qaccessiblewidget.h:108: error: 'RelationFlag' has not been declared
    c:\Qt\2009.05\qt\include\QtGui/../../src/gui/accessible/qaccessiblewidget.h:110: error: 'Text' has not been declared
    c:\Qt\2009.05\qt\include\QtGui/../../src/gui/accessible/qaccessiblewidget.h:111: error: 'Role' does not name a type
    c:\Qt\2009.05\qt\include\QtGui/../../src/gui/accessible/qaccessiblewidget.h:112: error: 'State' does not name a type
    c:\Qt\2009.05\qt\include\QtGui/../../src/gui/accessible/qaccessiblewidget.h:114: error: 'Text' has not been declared
    c:\Qt\2009.05\qt\include\QtGui/../../src/gui/accessible/qaccessiblewidget.h:117: error: 'Method' has not been declared
    c:\Qt\2009.05\qt\include\QtGui/../../src/gui/accessible/qaccessiblewidget.h:100: error: 'Client' was not declared in this scope

  4. #4
    Join Date
    Oct 2009
    Posts
    151
    Thanks
    6
    Thanked 13 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: cant make program run C++ gui programming

    It looks like you have not got QT installed properly, the very first line of the error message indicates that
    C:\Qt\2009.03\qt\include\QtGui\qaccessibleobject.h can not be found.

    Check to see if this file actually exists on your PC. If it does, there is probably an error in your QT path.

  5. #5
    Join Date
    Jan 2010
    Posts
    63
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: cant make program run C++ gui programming

    ok I am going to reinstall. This is strange, since I have created the hello dialog button and simple popup.

  6. #6
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: cant make program run C++ gui programming

    Ensure your book/tutorial/examples/etc uses Qt4.5, not Qt3. otherwise you could have problems.

  7. #7
    Join Date
    Jan 2010
    Posts
    63
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: cant make program run C++ gui programming

    I reinstalled and it ran . Now I get these errors:
    CreateProcess(): Access is denied.

    mingw32-make[1]: *** [debug/FindDialog.o] Error 123
    mingw32-make: *** [debug] Error 2
    Exited with code 2.
    Error while building project FindDialog
    When executing build step 'Make'

    I thought it might have occured when I configured Comodo Firewall to accept all signals from environment. I get these erros when I ran th address program too. I reinstalled and still got 'em . Help !Q

  8. #8
    Join Date
    Oct 2009
    Posts
    151
    Thanks
    6
    Thanked 13 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: cant make program run C++ gui programming

    Interesting, the CreateProcess() message is actually generated by Windows not QT.

    It usually means that there is a problem using long filenames, what version of Windows are you running, have you installed all the service packs?

    You could try putting quotes around your file names, or make sure that they are unique upto any spaces.

    A typical culprit that causes this error is "Program".
    Versions of Windows that suffer from this problem can not tell the difference between "Program files", "Program folders" etc unless they are quoted.

  9. #9
    Join Date
    Jan 2010
    Posts
    63
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: cant make program run C++ gui programming

    I have XP PRO with all the service packs installed

  10. #10
    Join Date
    Oct 2009
    Posts
    151
    Thanks
    6
    Thanked 13 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: cant make program run C++ gui programming

    Did you get any other output?

    I believe that error 123 signifies that there is something wrong with a Volume, Folder or File name and
    error 2 means that something (probably a file) can not be found.

    Do any of the paths contain Unix style '/' instead of '\' ?

  11. #11
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: cant make program run C++ gui programming

    If those are Windows error codes, then http://msdn.microsoft.com/en-us/libr...8VS.85%29.aspx

    ERROR_INVALID_NAME
    123 (0x7B)
    The filename, directory name, or volume label syntax is incorrect.

    ERROR_FILE_NOT_FOUND
    2 (0x2)
    The system cannot find the file specified.

    Also, "debug/FindDialog.o" doesn't look like a valid path to me for a Windows OS.

Similar Threads

  1. Replies: 6
    Last Post: 10th March 2011, 16:42
  2. Replies: 7
    Last Post: 19th January 2008, 15:29
  3. How do I make a program out of my program?
    By Randulf in forum Newbie
    Replies: 1
    Last Post: 29th May 2007, 11:11
  4. How to make my program wait for 2 seconds ?
    By probine in forum Qt Programming
    Replies: 2
    Last Post: 26th December 2006, 13:31
  5. how to make program wait
    By psmech in forum Qt Programming
    Replies: 3
    Last Post: 26th May 2006, 05:24

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
  •  
Qt is a trademark of The Qt Company.