open_coder
July 7th, 2007, 05:57 AM
Hey guys. I have a very disturbing problem that I am desperately trying to fix. I installed all the libraries to develop with Qt4. I started to run through the Qt4 tutorials, found here (http://doc.trolltech.com/4.0/examples.html). Well, the first one is a small hello world program. The code is below:
/************************************************** **************
**
** Qt tutorial 1
**
************************************************** **************/
#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();
}
However, when I try to compile it, I receive the following error:
hello.cpp:7:28: error: QApplication: No such file or directory
hello.cpp:8:27: error: QPushButton: No such file or directory
hello.cpp:21:6: warning: no newline at end of file
hello.cpp: In function ‘int main(int, char**)’:
hello.cpp:14: error: ‘QApplication’ was not declared in this scope
hello.cpp:14: error: expected `;' before ‘app’
hello.cpp:16: error: ‘QPushButton’ was not declared in this scope
hello.cpp:16: error: expected `;' before ‘hello’
hello.cpp:17: error: ‘hello’ was not declared in this scope
hello.cpp:20: error: ‘app’ was not declared in this scope
I tried to figure out what was wrong, but as best I can tell, the problem is that gcc doesn't know where the libraries are installed at. How do I fix this? Is there a way to add the path to the libraries to gcc's search path?
Thanks guys,
--Alex
/************************************************** **************
**
** Qt tutorial 1
**
************************************************** **************/
#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();
}
However, when I try to compile it, I receive the following error:
hello.cpp:7:28: error: QApplication: No such file or directory
hello.cpp:8:27: error: QPushButton: No such file or directory
hello.cpp:21:6: warning: no newline at end of file
hello.cpp: In function ‘int main(int, char**)’:
hello.cpp:14: error: ‘QApplication’ was not declared in this scope
hello.cpp:14: error: expected `;' before ‘app’
hello.cpp:16: error: ‘QPushButton’ was not declared in this scope
hello.cpp:16: error: expected `;' before ‘hello’
hello.cpp:17: error: ‘hello’ was not declared in this scope
hello.cpp:20: error: ‘app’ was not declared in this scope
I tried to figure out what was wrong, but as best I can tell, the problem is that gcc doesn't know where the libraries are installed at. How do I fix this? Is there a way to add the path to the libraries to gcc's search path?
Thanks guys,
--Alex