if you already have the cyg and g
TRANSCRIPT
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 1/223
If
you alreadyhave the
Cygwin gccand g++
compilers,GNU make,and gdb debu
gger installed
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 2/223
on your Windows
system andyour path is
set upcorrectly to
find them,make sure
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 3/223
that you havethe correct
versions.To check the
versions of your Cygwin
compilersand tools:
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 4/223
1. Check theversion of
Cygwinenvironment
by typing thefollowing
commandsat a
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 5/223
Windowscommand
prompt:2.
3. C:\>cygcheck
-c cygwin
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 6/223
4. Check theversions of
the Cygwingcc and g++
compilers, make,
and gdb by
typing the
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 7/223
followingcommands
at aWindows
commandprompt:
5.
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 8/223
6. C:\>gcc --
version7. C:\>
g++ --version
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 9/223
8. C:\>make --
version9. C:\>
gdb --version
If you havethe correct
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 10/223
versions, thenno further
setup isnecessary.
See Verifyingthe
Installation toverify that the
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 11/223
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 12/223
compilers, m ake,
and gdb debugger
from cygwin.com: 1. Refer to
the Cygwin
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 13/223
User'sGuide for
completeinformation
aboutinstalling
and usingCygwin.
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 14/223
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 15/223
the leftnavigation
bar, or byclicking this
direct setup.exe link.
3. Run
the setup.
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 16/223
exe program. Accept
the defaultsuntil you
reach theSelect Your
InternetConnection
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 17/223
page. Selectthe option
on this pagethat is best
for you.Click Next.
4. On theChoose
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 18/223
DownloadSite page,
choose adownload
site youthink might
be relatively
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 19/223
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 20/223
download.Click the +
next toDevel to
expand thedevelopment
toolscategory.
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 21/223
You maywant to
resize thewindow so
you can seemore of it at
one time.
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 22/223
6. Selecteach
package youwant to
download byclicking the
Skip labelnext to it,
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 23/223
whichreveals the
versionnumber of
the packageto download.
At a
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 24/223
minimum,select
gcc-core: Ccompiler
gcc-g++:C++compiler
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 25/223
gdb: TheGNU
Debugger make: the
GNU versionof the 'make'
utility
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 26/223
Packagesthat are
required bythe
packagesyou select
areautomaticall
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 27/223
y selectedas well.
7. Click Nextto connect to
thedownload
site anddownload
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 28/223
thepackages
youselected,
and clickFinish when
the
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 29/223
installation iscomplete.
8. Now addthe Cygwin
compiler directory to
your path toenable
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 30/223
NetBeansIDE to find
the toolscollection:
0. Open theControlPanel:
- On
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 31/223
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 32/223
System.- On
Windows 7,type var in
the Startmenu's
search boxto quickly
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 33/223
find a linkto Edit the
systemenvironmen
t variables.1. Select
the Advanced
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 34/223
tab andclick
Environment
Variables.2. In the
SystemVariables
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 35/223
panel of theEnvironme
ntVariables
dialog,select
the Path v
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 36/223
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 37/223
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 38/223
y is C:\cygwin.
Directorynames
must beseparatedwith a
semicolon.
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 39/223
Your editedpath should
looksomething
like %SystemRoot%\
system32;%System
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 40/223
Root%;C:
\Program
Files\QuickTime\
QTSystem;C:\cygw
in\bin
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 41/223
4. Click OKin the
Environment
Variablesdialog and
the System
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 42/223
Propertiesdialog.
5. See Verif ying the
Installation to verify
that thetools were
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 43/223
installedcorrectly for
theNetBeans
IDE.MinGW
Compilersand Tools
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 44/223
NetBeansIDE 7.3 was
tested withMinimalist
GNU for Windows
(MinGW) andthe Minimal
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 45/223
System(MSYS) Unix-
likeenvironment.
Versionstested and
installationinstructions
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 46/223
are shownbelow.
Note. If youwant to use
Qt withWindows,
see thearticle Workin
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 47/223
g with Qt Applications f
or instructions
for installingMinGW and
Qt software.Sof Ve Descr
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 48/223
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 49/223
c 6.2 compiler
g+
+
4.
6.2
MinGW
C++compil
er gd
7. MinG
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 50/223
b 4 WGNU
debugger
ma
ke 3.81
MSYS make
utility
Note
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 51/223
thatMinG
Wmake
is notsuppo
rted
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 52/223
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 53/223
from mingw.org:
1. Log in toWindows
using anaccount with
computer
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 54/223
administrator privileges.
2. Downloadthe MinGW
installer from http://s
ourceforge.n
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 55/223
et/projects/mingw.
3. Run theMinGW
installer,which
should havea file name
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 56/223
similar to mingw-
get-inst-20120426.
exe.4. Accept thedefault C:\M
inGW as the
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 57/223
destinationfolder if
possible tominimize
any potentialdifficulty with
using thecompilers
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 58/223
from another location.
5. In theMinGW
installer select the
following
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 59/223
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 60/223
Fortran programs)
MSYS BasicSystem
MinGWDeveloper Toolkit
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 61/223
6. ClickInstall and
wait a fewminutes
while theinstaller
programdownloads
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 62/223
thecomponents
youselected.
7. ClickFinish when
thepackages
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 63/223
are finisheddownloading
.You must add
the paths tothe the
binaries for MinGW and
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 64/223
MSYS toolsto your
PATH. If youinstalled to
the defaultlocation the
pathsare C:\MinG
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 65/223
W\bin andC:\MinGW\MSY
S\1.0\bin.To edit your
PATHenvironmentvariable in
Windows:
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 66/223
1. Open theEnvironment
Variableswindow: On WindowsXP and
Windows2000: Right-
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 67/223
click MyComputer >
Properties > Advanced
tab >Environment
Variablesbutton.
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 68/223
On WindowsVista and
Windows 7:Right-click
MyComputer >
Properties > Advanced
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 69/223
SystemSettings link
>Environment
Variablesbutton.
2. In theEnvironment
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 70/223
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 71/223
section andclick Edit.
3. At the endof the path,
insert asemi-colon
and add thepaths to the
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 72/223
executablesfor MinGW
and MSYS.Use semi-
colonsbetween the
paths anddo not use
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 73/223
any spaces.Be careful
not toremove
anythingalready on
your PATHor your
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 74/223
computer might not
workcorrectly.
When youare finished,
your pathshould look
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 75/223
similar to thefollowing:
%SystemRo
ot%\system32;%Syst
emRoot%;%SystemRoo
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 76/223
t%\System
32\Wbem;
%SYSTEMROOT%\Syste
m32\WindowsPowerSh
ell\v1.0;C:\MinGW\
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 77/223
bin;C:\Mi
nGW\MSYS\
1.0\bin4. Click OK
in theEnvironment
Variableswindow.
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 78/223
See Verifyingthe
Installation toverify that the
tools wereinstalled
correctly for
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 79/223
the NetBeansIDE.
MicrosoftWindows
TheNetBeans
C/C++module has
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 80/223
been testedwith
compilersfrom Cygwin
and MinGW.If you install
both Cygwinand MinGW,
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 81/223
be careful tokeep their
installationlocations
completelyseparate and
do not mixtools from
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 82/223
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 83/223
Windows, youmust use
MinGW. Seethe
article Working with Qt
Applications f or instructions
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 84/223
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 85/223
and Tools
Cygwin
Compilersand Tools
TheNetBeans
C/C++module has
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 86/223
been testedwith the
followingcompilers and
toolsfrom Cygwin.
com.Soft Ve Des
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 87/223
wareor
Resource
rsion
Test
ed
cription
cygw
in1.dll
1.7
.7,1.7
Cyg
winLinu
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 88/223
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 89/223
s
gcc 4.3
.4
Cyg
winC
compiler
g++ 4.3
.4
Cyg
win
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 90/223
C++com
piler
gdb 6.8
Cyg
winGN
Udeb
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 91/223
ugger
make 3.81
Cygwin
make
utility
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 92/223
If you alreadyhave the
Cygwin gccand g++
compilers,GNU make,
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 93/223
and gdb debugger installed
on your Windows
system andyour path is
set upcorrectly to
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 94/223
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 95/223
compilersand tools:
1. Check theversion of
Cygwinenvironment
by typing thefollowing
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 96/223
commandsat a
Windowscommand
prompt:2.
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 97/223
3. C:\>cygcheck
-c cygwin4. Check the
versions of the Cygwin
gcc and g++compilers, m
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 98/223
ake,and gdb by
typing thefollowing
commandsat aWindows
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 99/223
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 100/223
7. C:\>g++ --
version8. C:\>
make --version
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 101/223
9. C:\>gdb --
versionIf you have
the correctversions, then
no further setup is
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 102/223
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 103/223
the NetBeansIDE.
To install theGNU gcc
and g++compilers, m
ake,
and gdb deb
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 104/223
ugger from cygwin.
com: 1. Refer to
the CygwinUser's
Guide for complete
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 105/223
informationabout
installingand using
Cygwin.2. Download
theCygwin set
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 106/223
up.exe program by
clickingInstall
Cygwin inthe left
navigationbar, or by
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 107/223
clicking thisdirect setup
.exe link.3. Run
the setup.
exe program. Accept
the defaults
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 108/223
until youreach the
Select Your Internet
Connectionpage. Select
the optionon this page
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 109/223
that is bestfor you.
Click Next.4. On the
ChooseDownload
Site page,choose a
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 110/223
downloadsite you
think mightbe relatively
close to you.Click Next.
5. On theSelect
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 111/223
Packagespage you
select thepackages to
download.Click the +
next toDevel to
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 112/223
expand thedevelopment
toolscategory.
You maywant to
resize thewindow so
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 113/223
you can seemore of it at
one time.6. Select
eachpackage you
want todownload by
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 114/223
clicking theSkip label
next to it,which
reveals theversion
number of the package
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 115/223
to download. At a
minimum,select gcc-core: Ccompiler
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 116/223
gcc-g++:C++
compiler gdb: The
GNUDebugger
make: the
GNU version
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 117/223
of the 'make'utility
Packagesthat are
required bythe
packagesyou select
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 118/223
areautomaticall
y selectedas well.
7. Click Nextto connect to
thedownload
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 119/223
site anddownload
thepackages
youselected,
and clickFinish when
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 120/223
theinstallation is
complete.8. Now add
the Cygwincompiler
directory toyour path to
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 121/223
enableNetBeans
IDE to findthe tools
collection:0. Open theControl
Panel:
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 122/223
- OnWindows
XP selectStart >
Settings >Control
Panel anddouble-
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 123/223
clickSystem.
- OnWindows 7,
type var inthe Start
menu'ssearch box
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 124/223
to quicklyfind a link
to Edit thesystem
environment variables.
1. Selectthe
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 125/223
Advancedtab and
clickEnvironme
ntVariables.
2. In theSystem
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 126/223
Variablespanel of the
Environment
Variablesdialog,
selectthe Path v
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 127/223
ariable andclick Edit.
3. Add thepath to
the cygwin-
director
y \bin dire
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 128/223
ctory tothe Path v
ariable, andclick OK.
Bydefault, cy gwin-
director
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 129/223
y is C:\cygwin.
Directorynames
must beseparatedwith a
semicolon.
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 130/223
Your editedpath should
looksomething
like %SystemRoot%\
system32;%System
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 131/223
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 132/223
4. Click OKin the
Environment
Variablesdialog and
the System
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 133/223
Propertiesdialog.
5. See Verif ying the
Installation to verify
that thetools were
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 134/223
installedcorrectly for
theNetBeans
IDE.MinGW
Compilersand Tools
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 135/223
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 136/223
System(MSYS) Unix-
likeenvironment.
Versionstested and
installationinstructions
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 137/223
are shownbelow.
Note. If youwant to use
Qt withWindows,
see thearticle Workin
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 138/223
g with Qt Applications f
or instructions
for installingMinGW and
Qt software.Sof Ve Descr
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 139/223
tware
or Re
sourc
e
rsion
Test
ed
iption
gc 4. C
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 140/223
c 6.2 compiler
g+
+
4.
6.2
MinGW
C++compil
er gd
7. MinG
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 141/223
b 4 WGNU
debugger
ma
ke 3.81
MSYS make
utility
Note
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 142/223
thatMinG
Wmake
is notsuppo
rted
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 143/223
To install theGNU
compilers, m ake,
and gdb deb
ugger
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 144/223
from mingw.org:
1. Log in toWindows
using anaccount with
computer
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 145/223
administrator privileges.
2. Downloadthe MinGW
installer from http://s
ourceforge.n
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 146/223
et/projects/mingw.
3. Run theMinGW
installer,which
should havea file name
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 147/223
similar to mingw-
get-inst-20120426.
exe.4. Accept thedefault C:\M
inGW as the
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 148/223
destinationfolder if
possible tominimize
any potentialdifficulty with
using thecompilers
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 149/223
from another location.
5. In theMinGW
installer select the
following
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 150/223
componentsto install:
C C++ Fortran (if you will beworking on
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 151/223
Fortran programs)
MSYS BasicSystem
MinGWDeveloper Toolkit
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 152/223
6. ClickInstall and
wait a fewminutes
while theinstaller
programdownloads
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 153/223
thecomponents
youselected.
7. ClickFinish when
thepackages
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 154/223
are finisheddownloading
.You must add
the paths tothe the
binaries for MinGW and
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 155/223
MSYS toolsto your
PATH. If youinstalled to
the defaultlocation the
pathsare C:\MinG
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 156/223
W\bin andC:\MinGW\MSY
S\1.0\bin.To edit your
PATHenvironmentvariable in
Windows:
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 157/223
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 158/223
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 159/223
On WindowsVista and
Windows 7:Right-click
MyComputer >
Properties > Advanced
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 160/223
SystemSettings link
>Environment
Variablesbutton.
2. In theEnvironment
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 161/223
Variableswindow,
select thePath
variable inthe Systems
Variable
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 162/223
section andclick Edit.
3. At the endof the path,
insert asemi-colon
and add thepaths to the
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 163/223
executablesfor MinGW
and MSYS.Use semi-
colonsbetween the
paths anddo not use
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 164/223
any spaces.Be careful
not toremove
anythingalready on
your PATHor your
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 165/223
computer might not
workcorrectly.
When youare finished,
your pathshould look
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 166/223
similar to thefollowing:
%SystemRo
ot%\system32;%Syst
emRoot%;%SystemRoo
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 167/223
t%\System
32\Wbem;
%SYSTEMROOT%\Syste
m32\WindowsPowerSh
ell\v1.0;C:\MinGW\
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 168/223
bin;C:\Mi
nGW\MSYS\
1.0\bin4. Click OK
in theEnvironment
Variableswindow.
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 169/223
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 170/223
the NetBeansIDE.
Code can beentirely
compiled;hence no
implementation source
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 171/223
must bepublished
(distributingtemplate
librariesusually
requiresdistribution of
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 172/223
the sourcecode of the
templateimplementatio
ns).In contrast,
the followingcan be said
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 173/223
about staticpolymorphism
in C++:Collections of
built-in typesare easily
implemented.More
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 174/223
generally, theinterface
commonalityneed not be
expressedthrough a
commonbase class.
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 175/223
Generatedcode is
potentiallyfaster
(because noindirection
throughpointers is
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 176/223
needed a priori and
nonvirtualfunctions can
be inlinedmuch more
often).
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 177/223
Concretetypes that
provide onlypartial
interfaces canstill be used if
only that partends up
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 178/223
beingexercised
by theapplication.
Staticpolymorphism
is oftenregarded as
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 179/223
more typesafe than
dynamicpolymorphism
because allthe bindings
are
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 180/223
checked atcompile time.
For example,there is little
danger of inserting an
object of the
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 181/223
wrong type ina container
instantiatedfrom a
template.However, in a
container expecting
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 182/223
pointers to acommon
base class,there is a
possibilitythat these
pointersunintentionall
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 183/223
y end uppointing to
completeobjects of
differenttypes.
In practice,template
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 184/223
instantiationscan also
cause somegrief when
differentsemantic
assumptionshide behind
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 185/223
identical-looking
interfaces.For example,
surprises canoccur when a
template thatassumes an
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 186/223
associativeoperator
+ isinstantiated
for a type thatis not
associativewith respect
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 187/223
to thatoperator. In
practice, thiskind of
semanticmismatch
occurs lessoften with
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 188/223
inheritance-based
hierarchies,presumably
because theinterface
specificationis
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 189/223
moreexplicitly
specified.Combining
Both FormsOf course,
you couldcombine both
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 190/223
forms of inheritance.
For example,you could
derivedifferent kinds
of geometric
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 191/223
objects froma common
base class tobe able to
handleinhomogeneo
us collectionsof geometric
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 192/223
objects.However,
you can stilluse templates
to write codefor a certain
kind of
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 193/223
geometricobject.
Thecombination
of inheritanceand
templates isfurther
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 194/223
described inChapter 16.
We will see(among other
things)how the
virtuality of amember
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 195/223
function canbe
parameterized and how an
additionalamount of
flexibility isafforded to
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 196/223
staticpolymorphism
using theinheritance-
basedcuriously
recurring template
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 197/223
pattern (or CRTP ).
Ru-BrdThis
documentwas created
by an
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 198/223
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 199/223
78 CHAPTER
5: TheBuilding
Blocks of PHP. $_FILES
contains any
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 200/223
variablesprovided to a
script throughfile uploads.
. $_SERVERcontains
informationsuch as
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 201/223
headers, filepaths, and
scriptlocations.
. $_ENVcontains any
variablesprovided to a
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 202/223
script as partof the server
environment..
$_REQUESTcontains any
variablesprovided to a
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 203/223
script viaGET, POST,
or COOKIE
inputmechanisms.
. $_SESSIONcontains any
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 204/223
variables thatare currently
registered ina session.
Theexamples in
this book usesuperglobals
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 205/223
in allapplicable
situations.Using
superglobalsis crucial in
creatingsecure
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 206/223
applicationsbecause they
reduce thelikelihood
of user-injected input
to your scripts. By
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 207/223
coding your scripts to
accept onlywhat you
want, in themanner
defined byyou (from a
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 208/223
form usingthe POST
method, or from a
session, for example),
you caneliminate
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 209/223
some of theproblems
created byloosely
writtenscripts.
Data Types
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 210/223
Differenttypes of data
take updifferent
amounts of memory and
may betreated
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 211/223
differentlywhen they
aremanipulated
by a script.Some
programminglanguages
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 212/223
thereforedemand that
theprogrammer
declare inadvance
which type of data a
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 213/223
variable willcontain. By
contrast, PHPis loosely
typed ,meaning that
itautomatically
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 214/223
determinesthe data type
at the timedata is
assigned toeach variable.
Thisautomatic
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 215/223
typing is amixed
blessing. Onthe one hand,
it means thatvariables
can be usedflexibly—in
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 216/223
one instance,a variable can
hold a stringand then later
inthe script it
can hold aninteger or
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 217/223
some other data type. On
the other hand, this
flexibility canlead to
problems inlarger scripts
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 218/223
if you arespecifically
expecting avariable to
hold one datatype when in
fact it holdssomething
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 219/223
completelydifferent.
For example,suppose that
you havecreated code
to manipulate
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 220/223
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 221/223
and no arraystructure
is in place,errors will
occur whenthe code
attempts toperform
7/27/2019 If You Already Have the Cyg and g
http://slidepdf.com/reader/full/if-you-already-have-the-cyg-and-g 222/223
array-specificoperations
on thevariable.
Table 5.1shows the
eight