Pawel
16th October 2010, 17:56
Hi,
I'm actually learning how to code with QT and I can't understand why the following error appears.
Here is my Code:
#include <QApplication>
#include <QHBoxLayout>
#include <QSlider>
#include <QSpinBox>
int main(int argc, char *argv[]){
QApplication app(argc, argv);
QWidget *window = new QWidget();
window->setWindowTitle("Enter yout Age!");
QSpinBox *spinbox = new QSpinBox;
QSlider *slider = new QSlider(QT::Horizontal);
spinbox->setRange(0, 130);
slider->setRange(0, 130);
QObject::connect(spinbox, SIGNAL(valueChanged(int)), slider, SLOT(setValue(int)));
QObject::connect(slider, SIGNAL(valueChanged(int)), spinbox, SLOT(setValue(int)));
spinbox->setValue(35);
QHBoxLayout *layout = new QHBoxLayout;
layout->addWidget(spinbox);
layout->addWidget(slider);
window->setLayout(layout);
window->show();
return app.exec();
}
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?
I'm actually learning how to code with QT and I can't understand why the following error appears.
Here is my Code:
#include <QApplication>
#include <QHBoxLayout>
#include <QSlider>
#include <QSpinBox>
int main(int argc, char *argv[]){
QApplication app(argc, argv);
QWidget *window = new QWidget();
window->setWindowTitle("Enter yout Age!");
QSpinBox *spinbox = new QSpinBox;
QSlider *slider = new QSlider(QT::Horizontal);
spinbox->setRange(0, 130);
slider->setRange(0, 130);
QObject::connect(spinbox, SIGNAL(valueChanged(int)), slider, SLOT(setValue(int)));
QObject::connect(slider, SIGNAL(valueChanged(int)), spinbox, SLOT(setValue(int)));
spinbox->setValue(35);
QHBoxLayout *layout = new QHBoxLayout;
layout->addWidget(spinbox);
layout->addWidget(slider);
window->setLayout(layout);
window->show();
return app.exec();
}
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?