CDRW
5th August 2011, 06:24
Hi,
I'm trying to learn the Qt framework as best as I can, and I thought the best course of action for this was to work through the tutorials, one at a time. I originally used the add-in for VS2010 on my first try to compile cpp files meant for Qt. The problem I am always having is that it reports QApplication and QPushbutton, as in the first two includes in the first "Hello world" application on the tutorial, as missing. I searched and found them located in QtGUI. I tried to use them and it resulted in it reporting that the functions were not valid, even going as far as to move the header files into the project directory, nothing. I rebuilt the Qt binaries and made sure all of my build targets were correct, before giving up and getting Qt SDK.
Now I'm having the same problem in Qt SDK. Build target appears to be correct, it works just fine for Qt Quick applications, but it does not appear to be able to build any files or example projects that I download. Searching for a similar problem is just making me run in circles doing the same things over and over again.
Here is the code
#include <QCoreApplication>
#include <QApplication>
#include <QPushButton>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QPushButton hello("Hello world!");
hello.resize(100, 30);
hello.show();
return app.exec();
}
Putting this into Qt SDK results in it claiming that it can't find QApplication or QtPushButton.
Changing this to
#include <QtGUI\QApplication>
#include <QtGUI\QPushButton>
Removes the problem, but now it claims that the function is invalid, or at least that's what I think it is saying.
D:\Qt\test\main.cpp:-1: error: undefined reference to `_imp___ZN12QApplicationC1ERiPPcbi'
D:\Qt\test\main.cpp:-1: error: undefined reference to `_imp___ZN11QPushButtonC1ERK7QStringP7QWidget'
It's likely something very small and very stupid (probably some stupid step I skipped). Any ideas are welcome, assume that I have no idea what I am doing.
I'm trying to learn the Qt framework as best as I can, and I thought the best course of action for this was to work through the tutorials, one at a time. I originally used the add-in for VS2010 on my first try to compile cpp files meant for Qt. The problem I am always having is that it reports QApplication and QPushbutton, as in the first two includes in the first "Hello world" application on the tutorial, as missing. I searched and found them located in QtGUI. I tried to use them and it resulted in it reporting that the functions were not valid, even going as far as to move the header files into the project directory, nothing. I rebuilt the Qt binaries and made sure all of my build targets were correct, before giving up and getting Qt SDK.
Now I'm having the same problem in Qt SDK. Build target appears to be correct, it works just fine for Qt Quick applications, but it does not appear to be able to build any files or example projects that I download. Searching for a similar problem is just making me run in circles doing the same things over and over again.
Here is the code
#include <QCoreApplication>
#include <QApplication>
#include <QPushButton>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QPushButton hello("Hello world!");
hello.resize(100, 30);
hello.show();
return app.exec();
}
Putting this into Qt SDK results in it claiming that it can't find QApplication or QtPushButton.
Changing this to
#include <QtGUI\QApplication>
#include <QtGUI\QPushButton>
Removes the problem, but now it claims that the function is invalid, or at least that's what I think it is saying.
D:\Qt\test\main.cpp:-1: error: undefined reference to `_imp___ZN12QApplicationC1ERiPPcbi'
D:\Qt\test\main.cpp:-1: error: undefined reference to `_imp___ZN11QPushButtonC1ERK7QStringP7QWidget'
It's likely something very small and very stupid (probably some stupid step I skipped). Any ideas are welcome, assume that I have no idea what I am doing.