Results 1 to 3 of 3

Thread: Why do i get this error?

  1. #1
    Join Date
    Oct 2010
    Posts
    2

    Default Why do i get this error?

    Hi,
    I'm actually learning how to code with QT and I can't understand why the following error appears.

    Here is my Code:
    Qt Code:
    1. #include <QApplication>
    2. #include <QHBoxLayout>
    3. #include <QSlider>
    4. #include <QSpinBox>
    5.  
    6. int main(int argc, char *argv[]){
    7. QApplication app(argc, argv);
    8.  
    9. QWidget *window = new QWidget();
    10. window->setWindowTitle("Enter yout Age!");
    11.  
    12. QSpinBox *spinbox = new QSpinBox;
    13. QSlider *slider = new QSlider(QT::Horizontal);
    14. spinbox->setRange(0, 130);
    15. slider->setRange(0, 130);
    16.  
    17. QObject::connect(spinbox, SIGNAL(valueChanged(int)), slider, SLOT(setValue(int)));
    18. QObject::connect(slider, SIGNAL(valueChanged(int)), spinbox, SLOT(setValue(int)));
    19. spinbox->setValue(35);
    20.  
    21. QHBoxLayout *layout = new QHBoxLayout;
    22. layout->addWidget(spinbox);
    23. layout->addWidget(slider);
    24. window->setLayout(layout);
    25.  
    26. window->show();
    27.  
    28. return app.exec();
    29. }
    To copy to clipboard, switch view to plain text mode 

    And I get this error:

    main.cpp
    .\main.cpp(13) : error C2653: 'QT': is not a class or namespace
    .\main.cpp(13) : error C2065: 'Horizontal': undeclared identifier

    Can someone help me?

  2. #2
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android
    Thanks
    62
    Thanked 260 Times in 246 Posts

    Default Re: Why do i get this error?

    It because there is no QT namespace, the correct version is Qt::Horizontal (is t not T)

  3. #3
    Join Date
    Oct 2010
    Posts
    2

    Default Re: Why do i get this error?

    AHmm, why didn't I realize it myself?
    Big thx
    Now I can go on ^^

Similar Threads

  1. no compile error, but error on run with QMenu QAction
    By sincnarf in forum Qt Programming
    Replies: 4
    Last Post: 4th May 2011, 11:05
  2. fatal error C1001: An internal error has occurred in the compiler
    By noodles in forum Installation and Deployment
    Replies: 0
    Last Post: 12th August 2010, 11:24
  3. Replies: 1
    Last Post: 25th October 2008, 19:18
  4. qTextEdit error - clipboard error
    By bruccutler in forum Qt Programming
    Replies: 1
    Last Post: 21st May 2007, 09:21
  5. ERROR:: QPainter: Internal error; no available GC
    By Krishnacins in forum Qt Programming
    Replies: 2
    Last Post: 8th March 2006, 06:05

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.