Download presentation
Presentation is loading. Please wait.
1
How to Program
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 #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 Setup Windows Environment Variables: Open your System Control Panel: Select [start]->Control Panel->System
5
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.
6
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. 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
7
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
© 2024 SlidePlayer.com. Inc.
All rights reserved.