C++ Tutorial 1

1. Install Netbeans and Cygwin.

Go to
https://netbeans.org/
Download Netbeans:





Download the bin file and unzip it.



Put the extracted one under C drive and rename it:



Go into this folder and find the .exe file in the 'bin' folder (double click the 64-bit version):



Sart a new project:



You may not have the C++ plugins as I have below:



Let's add it. Go to Tools - Plugins:



Check the following box:



Come back to the 'Available Plugins' tag and click 'Check for Newest':



Select the C/C++ one and click 'install':



This may takes a few minutes to be installed.

Now, we need to download and install the Cygwin C++ complier:

Go to the webpage: https://www.cygwin.com/

Find the installation link:



Download it:



Then:



Then it is fine to pick up the first mirror:




Then, there are four packages need to be downloaded:
gcc-core: C compiler
gcc-g++: C++ compiler
gdb: The GNU Debugger
make: the GNU version of the 'make' utility

Do not forget to click the 'skip' dropdown menu to select a newer version:



Then click Next to install these four packages:



Do not create icons:



From the 'Start Menu', start the Environment Variable settings:



Click 'Environmental Variables' and click 'OK':



Then do the following steps. Keep in mind that I already have the path for Cygwin in my environment variable. If you do not have it, you need to create it following steps below:







After this is added, Netbeans is ready to run C++:

Create a new project:



I named it 'test' and I just put it on the Desktop (make sure the path to desktop on your computer does not have Space/Symbol/Numbers):

Double click the 'main.cpp' file in the navigation menu, add '#include <stdio.h>" and "printf("Hello FLC")" to the code then click run. The results will appear in the console.



2. Some shortcuts in Netbeans

 ctrl + shift + c: comment/uncomment highlighted code
ctrl + shift + enter: maximize the coding window
shift + enter: insert a new line below

More can be found in this PDF webpage.

3. Install GVim and use cmd to code

(If you prefer MinGW instead of Cygwin for your g++ compiler, you can follow the instruction here).

Download GVim to Windows:



Use the default options to install GVim, you don't need to change any settings, just keep clicking 'Next'.

Go go the Environmental Variable setting:



Click "Environmental Variables" - "Path" - Edit - "New" - Add the path to the directory of GVim on your computer:



After you add GVim's path to the Environmental Variable, you will be able to open a Vim doc in the cmd window anywhere (for example, the Desktop):



GVim opened in a cmd widow:



You can type your C++ code in vim and save it on your Desktop after this configuration.

Now, if you want to compile the .cpp code you saved on Desktop and run it in the cmd window, you need to add Cygwin's bin foder to the Environmental Variables' list:



Now, you can type your code in Vim, save it on the Desktop, compile it in the cmd window and see the results in the cmd window as well:







When the 'test.exe' file is ready, you can directly type the name of the exe file in the cmd widow to run it there.