Download presentation
Presentation is loading. Please wait.
1
How to Start Programming in Linux Environment
Dr. Munesh Singh
2
Install the Compiler Open up the terminal and install vim by entering the following commands. dnf -y update dnf -y install vim-enhanced Install necessary development tools (if not installed already). This includes the compiler. dnf group install 'Development Tools‘ Create a new C/C++ program with this vim command. vi example.c
3
Compile the code Press the i key or the insert key to start writing the program. After you have completed the program save and exit vim by typing :wq Esc /:wq #include<stdio.h> int main() { printf("Hello World\n"); printf("Welcome to Tech Infected\n") return 0; } Compile cc example.c See the output /a.out
4
Setup Linux Environment in Window
Install Cygwin
10
Environmental setup Setup Windows Environment Variables:
Open your System Control Panel: Select [start]->Control Panel->System
11
Environmental Setup… lick on "Advanced System Settings", then select "Environmental Variables"
14
Setup Environmental Variable
Click on "Advanced System Settings", then select "Environmental Variables" under the "Advanced" tab of the "System Properties" Control Panel. Edit "System variable" as follows: Append "; C:\cygwin\bin" to Variable value: (semicolon is very important) Select "Ok" to close both "Environmental Variables" and "System Properties" windows.
15
Verify CygWin > gcc --version g++ (GCC) 4.8.1 ......
> g++ --version g++ (GCC) > gdb --version GNU gdb (GDB) 7.6.1
16
How to install MinGW Goto MinGW mother site at http://www.mingw.org/
Click on Downloads ⇒ Installer ⇒ click on "mingw-get-inst" link to download the installer.
17
MinGw…
18
MinGw.. Set the installation directory. e.g., "d:\myproject\mingw".
MinGW Installation Manager, select "Installation" ⇒ "Update Catalogue" ⇒ Select all packages in "Basic Setup" ⇒ continue (Apply). Setup environment variable PATH to include d:\myproject\mingw\bin“ Verify the GCC installation gcc --version
19
Get Started Compile/Link a Simple C Program - hello.c // hello.c
#include <stdio.h> int main() { printf("Hello, world!\n"); return 0; } Compile gcc hello.c Run ./a
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.