CYGWIN64 1 – Initiate Setup, first compile in Windows

The following article explain how to install cygwin64 in windows, and use normally in windows shell cmd or powershell, compile code and run code.

Install CYGWIN64

Install following extensions, by looking for “complete”, switch “skip” to the software version as below

  • gcc-core
  • gcc-g++
  • nano
Read more: CYGWIN64 1 – Initiate Setup, first compile in Windows

Add all bins executable files to your evironment as below:

Now you can run bash in your powershell or CMD

Compiling File to Exe:

First edit the code file, lets call it test.cpp with following codes:

    #include<iostream> 
 
    using namespace std; 
    int main() 
    { 
            cout<<" this is a print test"; 
            return 0; 
    } 

Now lets compile the file using g++, and output test.exe file. Notice the complier is g++ not gcc, and output file should be exe suffix.

g++ test.cpp -o test.exe

The following options show how to do it in both cmd or cygwin. Print is correctly done.

For more setup details in windows CMD, please refer to this reference:

https://stackoverflow.com/questions/5079180/what-is-the-difference-between-batch-and-bash-files#:~:text=%22Batch%20File%22%20is%20terminology%20normally,%2C%20or%20simply%20%22Script%22.