In this post I want to explain to you how I can make a C++/Qt program using the Sun IDE Netbeans.
First of all, I tried to do it with both NetBeans and Eclipse. However, I finally choose the first because Eclipse is really hard and uses many computer resources. In addition, I feel the window view of NetBeans more atracttive than Eclipse one.
So, the steps I neede to follow to reach my goal are explained on the next lines (I work with Ubuntu Feisty):
First of all, I tried to do it with both NetBeans and Eclipse. However, I finally choose the first because Eclipse is really hard and uses many computer resources. In addition, I feel the window view of NetBeans more atracttive than Eclipse one.
So, the steps I neede to follow to reach my goal are explained on the next lines (I work with Ubuntu Feisty):
- NetBeans instalation (download page) :
- $ chmod 777 netbeans-5_5_1-linux.bin
- $ sudo ./netbeans-5_5_1-linux.bin
- NetBeans C/C++ Pack instalation (download page):
- $ chmod 777 netbeans-c++-5_5_1_u1-linux.bin
- $ sudo ./netbeans-c++-5_5_1_u1-linux.bin
- Configure the C++ libraries (directories where .h files can be found) because NetBeans default configuration doesn't include them. In order to manage this configuration I had to go to: Tools -> Options -> C/C++ -> Code Assistance -> C++ Compiler. Once there I had to add all the C++ directories:
/usr/include/c++/4.1.2/backward/
/usr/include/c++/4.1.2/bits/
/usr/include/c++/4.1.2/debug/
/usr/include/c++/4.1.2/ext/
/usr/include/c++/4.1.2/i486-linux-gnu/
/usr/include/c++/4.1.2/tr1/
/usr/include/c++/4.1.2/
/usr/include/ /usr/local/include/
/usr/lib/gcc/i486-linux-gnu/4.1.2/include/
Some of them are redundant, but I added also.
You can see the window in the next image: - Configure the Qt libraries (directories where .h files can be found). In order to get this configuration I had to do right click on the project and then: Properties -> C/C++ -> C++ Compiler -> General -> Include Directories. Once there I had to include the Qt directory (/usr/include/qt4/ in my system):
In this moment NetBeans is configured and we can use C++ amb Qt!! :D
Here is a little peace of code:
#include <stdlib.h>
#include <QtGui/QApplication>
#include <QtGui/QPushButton>
int main(int argc, char** argv)
{
QApplication qapplication(argc, argv);
QPushButton hello("hello", 0);
hello.show();
return qapplication.exec();
}
And this is the explanation ^^
Here is a little peace of code:
#include <stdlib.h>
#include <QtGui/QApplication>
#include <QtGui/QPushButton>
int main(int argc, char** argv)
{
QApplication qapplication(argc, argv);
QPushButton hello("hello", 0);
hello.show();
return qapplication.exec();
}
And this is the explanation ^^