Qt Forum - programming with C++ and Qt
Register Calendar Members List Team Members Search Frequently Asked Questions Go to the Main Page

Qt Forum - programming with C++ and Qt » QtForum.org » Qt » Installing Qt » Qt v4.3.4 + NetBeans IDE 6.0.1 + Windows » Hello Guest [Login|Register]
Last Post | First Unread Post Print Page | Recommend to a Friend | Add Thread to Favorites
Post New Thread Post Reply
Go to the bottom of this page Qt v4.3.4 + NetBeans IDE 6.0.1 + Windows 3 Votes - Average Rating: 9.673 Votes - Average Rating: 9.673 Votes - Average Rating: 9.673 Votes - Average Rating: 9.673 Votes - Average Rating: 9.67
Author
Post « Previous Thread | Next Thread »
BernardoLG BernardoLG is a male
Assistant


Registration Date: 20.03.2008
Posts: 8

Level: 8 [?]
Experience: 456
Next Level: 674

218 points of experience needed for next level

Fragezeichen Qt v4.3.4 + NetBeans IDE 6.0.1 + Windows Reply to this Post Post Reply with Quote Edit/Delete Posts Report Post to a Moderator       Go to the top of this page

Greetings!
I'm trying to program under Windows, since I'm having some unsolved hardware issues with Kubuntu.
Now, I want to run Qt projects using NetBeans, but I'm having plenty of errors when trying to Build them.
If you know how to set all to work, if you already have it working, please share it here.
All help appreciated!

EDITED: see Tutorial posted!

This post has been edited 1 time(s), it was last edited by BernardoLG: 04.05.2008 13:54.

20.03.2008 23:19 BernardoLG is offline Send an Email to BernardoLG Search for Posts by BernardoLG Add BernardoLG to your Buddy List
BernardoLG BernardoLG is a male
Assistant


Registration Date: 20.03.2008
Posts: 8

Level: 8 [?]
Experience: 456
Next Level: 674

218 points of experience needed for next level

Thread Starter Thread Started by BernardoLG
Cygwin vs MinGW Reply to this Post Post Reply with Quote Edit/Delete Posts Report Post to a Moderator       Go to the top of this page

Seems to be that many of the problems are because of the Cygwin NetBeans is supposed to need.

I'm trying to use MinGW for the NetBeans, and I've been able to advance a bit on compiling Qt projects.

If you already know how, don't hesitate on posting it here.
21.03.2008 09:53 BernardoLG is offline Send an Email to BernardoLG Search for Posts by BernardoLG Add BernardoLG to your Buddy List
polzleitner
Assistant


Registration Date: 05.04.2008
Posts: 2

Level: 4 [?]
Experience: 83
Next Level: 100

17 points of experience needed for next level

Qt v4.3.4 + NetBeans IDE 6.0.1 + Windows + MinGw + CygWin Reply to this Post Post Reply with Quote Edit/Delete Posts Report Post to a Moderator       Go to the top of this page

Although this note was written for netbeans 6.0 it is equally valid for 6.1.

I have installed netbeans 6.0 under SuSE 10.3 plus Qt and got it working with some minor changes of the default netbeans settings. Under Windows it's a whole different story. The major difficulty was to figure out how to have mingw and cygwin coexist in Windows, and get Microsoft Visual Studio out of the way. (remark: Visual Studio is documented to work only in the commercial version of Qt).

The outline of what I did is here:
1. Install Qt as described in the Installation docs from Qt. Basically: download the two 4.3.4 files you find here: http://trolltech.com/developer/downloads/qt/windows (scroll down that page until you find http or ftp download sites).

Double-click the qt-win-opensource-4.3.4-mingw.exe file. This prompts you to download mingw. Install it to C:\Mingw.

Then proceed installing Qt to C:\Qt\4.3.4.

This basically gives you entries in the Windows Start Menu.

2. Build Qt

Open the Qt 4.3.4 Command Prompt from Windows Start.

You get a DOS-Box console window where you have good environments settings for Qt and MinGw to work together. In my case, when I type PATH in the console it get

PATH=C:\Qt\4.3.4\bin;C:\MinGW\bin;C:\WINDOWS\System32

It is crucial that you do not have a link to cygwin\bin somewhere in here only for the next two steps.

a) Now you can configure the Qt system for being compiled by typing

C:\Qt\4.3.4> configure -platform win32-g++

This took a while (15 min)

b) Compile and make it:

make
or
mingw32-make

This took 3 hours or more.

When this has completed you are ready to get into the netbeans stuff.

3. Netbeans

The best way is to start netbeans from the Qt-command window which has the minimalistic PATH settings by adding cygwin at the end of the path:

add cywin to the PATH
C:\Qt\4.3.4> PATH=%PATH%;C:\CygWin\bin

start netbeans:
C:\Qt\4.3.4> "C:\Program Files\Netbeans 6.0.1\bin\netbeans"

Change the above lines as required by your cygwin and netbeans installations. By doing this we ensure that the mingw compiler is found before the g++ that you might have on your cygwin, and that netbeans will find a sh.exe later when we run our programs.

In Netbeans select Tools->Options->C++
- In Build Tools you select the make tool to be mingw32-make
- In Code Assistance, C++ Compiler, you include all the subdirectories of C:\Qt\4.3.4\include that you need.
In my case I started out with C:\Qt\4.3.4\include,C:\Qt\4.3.4\include\Qt, C:\Qt\4.3.4\include\QtGui, C:\Qt\4.3.4\include\UITools, C:\Qt\4.3.4\include\QtCore.

Note: The inclusion of C:\Qt\4.3.4\include (although it does not contain any .h files) is mandatory for code completion to work (see comments on netbeans 6.1 below)

This step results in netbeans to get rid of the red underlines under lines like #include <QApplication>. They really won't matter because we will use Qt's make anyway, which has its own include path setting. But let's do this anyway.

4. New project in netbeans

Now let's get a new project in netbeans:
File-New Project->C++ Application and choose your project directory.

Don' t try to build it (yet).

5. Make the new project Qt-ready

Go back to the command line, navigate to your netbeans project directory. Example:
C:\Qt\4.3.4.> cd C:\_E\Work\C++\QtHello

C:\_E\Work\C++\QtHello> qmake -project CONFIG+=console
This creates a qtHello.pro file. The config option is essential when you want to see output from your cout and printf's.!!!!!!!!!

and

C:\_E\Work\C++\QtHello> qmake

qmake has to be done every time you add new source files to your project or rename them.

You should be able to build your program from netbeans now. (F11)

What needs to be done is to get Netbeans run your program with <F6>

6. Get it "running".

Open the project settings and change the Linker Output from dist/debug/MinGW-Windows/qtHello to debug/qtHello.

(Project Properties->Linker->General)

Now you can do a <F6> and your program will be built and run anytime you change your source code.


IMPORTANT: Now you can work in netbeans as usual with Java, etc. Don't forget the qmake when you add files to your project.

7. Code completion

What I have not yet figured out is how to get code completion working fully in Windows netbeans 6.0.1. In my Linux 6.0 installation Qt source code has full code completion. The Windows Qt code seems to be much more complex than that of Linux and code completion is not working fully at the moment. The netbeans developer team was extremely helpful in this respect and it seems code completion for Qt will work in netbeans 6.1 release (not in the current beta).

NEW: Install netbeans 6.1. It has full code completion both under Linux and Windows

I hope this helps.

Cheers,

Wolfgang

This post has been edited 13 time(s), it was last edited by polzleitner: 04.05.2008 11:31.

05.04.2008 11:36 polzleitner is offline Send an Email to polzleitner Search for Posts by polzleitner Add polzleitner to your Buddy List
BernardoLG BernardoLG is a male
Assistant


Registration Date: 20.03.2008
Posts: 8

Level: 8 [?]
Experience: 456
Next Level: 674

218 points of experience needed for next level

Thread Starter Thread Started by BernardoLG
Daumen hoch! RE: Qt v4.3.4 + NetBeans IDE 6.0.1 + Windows + MinGw + CygWin Reply to this Post Post Reply with Quote Edit/Delete Posts Report Post to a Moderator       Go to the top of this page

This've got to be the MOST complete tutorial for installing all of it!

Going to try it right now!

Thanks so much for the time to post it and help! smile smile smile smile smile
03.05.2008 22:31 BernardoLG is offline Send an Email to BernardoLG Search for Posts by BernardoLG Add BernardoLG to your Buddy List
datuputi datuputi is a male
Assistant


Registration Date: 04.05.2008
Posts: 2
Location: Mississauga

Level: 3 [?]
Experience: 26
Next Level: 54

28 points of experience needed for next level

Daumen hoch! RE: Qt v4.3.4 + NetBeans IDE 6.0.1 + Windows + MinGw + CygWin Reply to this Post Post Reply with Quote Edit/Delete Posts Report Post to a Moderator       Go to the top of this page

First off I'd llike to say Great Tutorial ! The best one I've found on this subject.
But I have one problem, I can't compile my "Hello World" application from inside Netbeans. I've followed your tutorial step-by-step (twice) and no matter what I can't get it to compile, inside Netbeans but works fine from the command line. I've pasted the output from my build below and highligthed the error, I've also pasted the file listing. The main problem is that when compiled the .o files are not being placed the the debug or release directories they are being named debugqthelloworld.o and releaseqthelloworld.o, but the mingw32-make.exe is looking for the files in debug and release directories. I realize that this is an issue related to path separators but not sure why or where this is happening. If anybody as any ideas it would be greatly appreciated. Thanks.

----------- build output----------------
Running "C:\Qt\MinGW\bin\mingw32-make.exe -f Makefile CONF=Debug" in C:\Qt\dev\qtHelloWorld
C:/Qt/MinGW/bin/mingw32-make.exe -f Makefile.Debug
mingw32-make.exe[1]: Entering directory `C:/Qt/dev/qtHelloWorld'
g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"..\..\4.3.4\include\QtCore" -I"..\..\4.3.4\include\QtCore" -I"..\..\4.3.4\include\QtGui" -I"..\..\4.3.4\include\QtGui" -I"..\..\4.3.4\include" -I"." -I"c:\Qt\4.3.4\include\ActiveQt" -I"debug" -I"." -I"..\..\4.3.4\mkspecs\win32-g++" -o debug\qthello.o qthello.cpp
g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -Wl,-subsystem,console -mthreads -Wl -o debug\qtHelloWorld.exe debug/qthello.o -L"c:\Qt\4.3.4\lib" -lQtGuid4 -lQtCored4

g++.exe: debug/qthello.o: No such file or directory
mingw32-make.exe[1]: *** [debug\qtHelloWorld.exe] Error 1
mingw32-make.exe[1]: Leaving directory `C:/Qt/dev/qtHelloWorld'
C:\Qt\MinGW\bin\mingw32-make.exe: *** [debug] Error 2
Build failed. Exit value 2.

---------------- file listing ---------------------
Directory of C:\Qt\dev\qtHelloWorld

03/05/2008 09:18 PM <DIR> .
03/05/2008 09:18 PM <DIR> ..
03/05/2008 09:18 PM <DIR> debug
03/05/2008 09:18 PM 5,838 debugqthello.o
03/05/2008 09:18 PM 5,209 Makefile
03/05/2008 09:18 PM 4,537 Makefile.Debug
03/05/2008 09:18 PM 4,582 Makefile.Release
03/05/2008 09:18 PM <DIR> nbproject
03/05/2008 09:18 PM 249 qthello.cpp
03/05/2008 09:18 PM 328 qtHelloWorld.pro
03/05/2008 09:18 PM <DIR> release

This post has been edited 2 time(s), it was last edited by datuputi: 04.05.2008 03:35.

04.05.2008 03:30 datuputi is offline Send an Email to datuputi Homepage of datuputi Search for Posts by datuputi Add datuputi to your Buddy List
polzleitner
Assistant


Registration Date: 05.04.2008
Posts: 2

Level: 4 [?]
Experience: 83
Next Level: 100

17 points of experience needed for next level

RE: Qt v4.3.4 + NetBeans IDE 6.0.1 + Windows + MinGw + CygWin Reply to this Post Post Reply with Quote Edit/Delete Posts Report Post to a Moderator       Go to the top of this page

Looks like your debug/qthello.o gets converted to debugqthello.o. Then it is not found by other programs which think it's under debug/qthello.o. This has happened to me when the g++ that was executed was not the mingw one, but the cygwin version. Try the following: from the shell where you start netbeans, type PATH to see what your PATH is. Also look on your system for another g++ program (probably C:\cygwin\bin, or wherever you might have a cygwin installation). I am pretty sure you have the wrong g++ in your PATH.

Sometimes running a "make clean", or "mingw32-make clean" helps.

W.

This post has been edited 2 time(s), it was last edited by polzleitner: 04.05.2008 11:19.

04.05.2008 11:18 polzleitner is offline Send an Email to polzleitner Search for Posts by polzleitner Add polzleitner to your Buddy List
BernardoLG BernardoLG is a male
Assistant


Registration Date: 20.03.2008
Posts: 8

Level: 8 [?]
Experience: 456
Next Level: 674

218 points of experience needed for next level

Thread Starter Thread Started by BernardoLG
Daumen hoch! Working just dandy! Reply to this Post Post Reply with Quote Edit/Delete Posts Report Post to a Moderator       Go to the top of this page

Installation successful, although it took about 8 hours on my PC.
Compiling and running just dandy!
Going to try some Qt examples and try to code some.
This should be moved to the "Tutorials" section cool
Thanks again Wolfgang!

Keep posting!
04.05.2008 18:58 BernardoLG is offline Send an Email to BernardoLG Search for Posts by BernardoLG Add BernardoLG to your Buddy List
datuputi datuputi is a male
Assistant


Registration Date: 04.05.2008
Posts: 2
Location: Mississauga

Level: 3 [?]
Experience: 26
Next Level: 54

28 points of experience needed for next level

RE: Qt v4.3.4 + NetBeans IDE 6.0.1 + Windows + MinGw + CygWin Reply to this Post Post Reply with Quote Edit/Delete Posts Report Post to a Moderator       Go to the top of this page

Polzleitner, thank you ! I finally got it working ! I can compile and run from inside Netbeans. I uninstalled all dev tools (make, g++, gcc, etc) from my Cygwin bin directory and launch Netbeans as per your suggestion. Again thanks.

Another issue now that I have it working. What application do you use for debugging (stepping thru code and such) ? I currently have gdb install on Cygwin but it seems to be very slow and and has even caused my Netbeans to stop responding. Any recommendations.

Thanks
07.05.2008 05:43 datuputi is offline Send an Email to datuputi Homepage of datuputi Search for Posts by datuputi Add datuputi to your Buddy List
ConradoQG
Assistant


Registration Date: 16.05.2008
Posts: 1

Level: 1 [?]
Experience: 1
Next Level: 10

9 points of experience needed for next level

Error Reply to this Post Post Reply with Quote Edit/Delete Posts Report Post to a Moderator       Go to the top of this page

I'm new in C++ and Qt.

Two questions, which is the usefulness of the cygwin in those steps?

It's happening the following errors when compiling :

code:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
C:/MinGW/bin/mingw32-make -f Makefile.Debug

mingw32-make[1]: Entering directory `C:/Documents and Settings/Conrado/Meus documentos/NetBeansProjects/Application_1'

gcc -c -g -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"c:\Qt\4.4.0\include\QtCore" -I"c:\Qt\4.4.0\include\QtCore" -I"c:\Qt\4.4.0\include\QtGui" -I"c:\Qt\4.4.0\include\QtGui" -I"c:\Qt\4.4.0\include" -I"." -I"c:\Qt\4.4.0\include\ActiveQt" -I"debug" -I"." -I"c:\Qt\4.4.0\mkspecs\win32-g++" -o debug\newmain.o newmain.c

In file included from c:/Qt/4.4.0/include/QtCore/qnamespace.h:1,

                 from c:/Qt/4.4.0/include/QtCore/../../src/corelib/kernel/qobjectdefs.h:47,

                 from c:/Qt/4.4.0/include/QtCore/qobjectdefs.h:1,

                 from c:/Qt/4.4.0/include/QtCore/../../src/corelib/kernel/qobject.h:49,

                 from c:/Qt/4.4.0/include/QtCore/qobject.h:1,

                 from c:/Qt/4.4.0/include/QtCore/../../src/corelib/kernel/qcoreapplication.h:47,

                 from c:/Qt/4.4.0/include/QtCore/qcoreapplication.h:1,

                 from c:/Qt/4.4.0/include/QtGui/../../src/gui/kernel/qapplication.h:47,

                 from c:/Qt/4.4.0/include/QtGui/qapplication.h:1,

                 from c:/Qt/4.4.0/include/QtGui/QApplication:1,

                 from newmain.c:1:

c:/Qt/4.4.0/include/QtCore/../../src/corelib/global/qnamespace.h:56: error: syntax error before "namespace"

c:/Qt/4.4.0/include/QtCore/../../src/corelib/global/qnamespace.h:60: error: syntax error before '{' token

c:/Qt/4.4.0/include/QtCore/../../src/corelib/global/qnamespace.h:127: warning: return type defaults to `int'

c:/Qt/4.4.0/include/QtCore/../../src/corelib/global/qnamespace.h: In function `Q_DECLARE_FLAGS':

c:/Qt/4.4.0/include/QtCore/../../src/corelib/global/qnamespace.h:128: error: `Qt' undeclared (first use in this function)

c:/Qt/4.4.0/include/QtCore/../../src/corelib/global/qnamespace.h:128: error: (Each undeclared identifier is reported only once

c:/Qt/4.4.0/include/QtCore/../../src/corelib/global/qnamespace.h:128: error: for each function it appears in.)

c:/Qt/4.4.0/include/QtCore/../../src/corelib/global/qnamespace.h:128: confused by earlier errors, bailing out

mingw32-make[1]: *** [debug/newmain.o] Error 1

mingw32-make[1]: Leaving directory `C:/Documents and Settings/Conrado/Meus documentos/NetBeansProjects/Application_1'

mingw32-make: *** [debug] Error 2


This code i'm trying to compile
code:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
 #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();
 }



Thanks

This post has been edited 1 time(s), it was last edited by ConradoQG: Today, 02:16.

Today, 02:13 ConradoQG is offline Send an Email to ConradoQG Search for Posts by ConradoQG Add ConradoQG to your Buddy List
Tree Structure | Board Structure
Jump to:
Post New Thread Post Reply
Qt Forum - programming with C++ and Qt » QtForum.org » Qt » Installing Qt » Qt v4.3.4 + NetBeans IDE 6.0.1 + Windows

views today: 9.787 | views yesterday: 17.520 | total views: 10.243.156


Klebekork Shop - Linux Shop - Kontaktanzeigen - Linux Forum -  SMS Gewinnspiel -  Hotels -  Stadtpläne -  Branchenbuch & Stadtplan

Branchenbuch Österreich - Branchenbuch Niederlande - Portugal Branchenverzeichnis - Spanien Branchenverzeichnis 
Telefonbuch - Branchenbuch Frankreich