0% found this document useful (0 votes)
19 views18 pages

How To Start A C Program

Uploaded by

dennismwenda342
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views18 pages

How To Start A C Program

Uploaded by

dennismwenda342
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

Introduction to Programming

1
Lecture notes : courtesy of Woo Kyun and Chang Byung-Mo
simple C program (hello.c)

output:

Hello, World !

2
C compiler
 compiler?
 Programmer can use high level language such as C
 CPU knows machine language (assembly language)

C program Machine
Compiler language
int main… 010101…

 C compiler
 Commercial compiler: Microsoft Visual C/C++ (ver. 6.0)
 Free compiler: gcc

3
IDE environment
 Microsoft Visual C++ 6.0/Code blocks or Dev c++
 Project window
 Editing window
 Message window

4
Program Development

1. Creating Project
2. Adding Files
3. Editing Program
4. Compile&Build
5. Execution&Debugging

5
Creating a Project (1/5)
1. File  New
Projects tab
Win32 Console Application
2. Location
3. Project Name
4. OK
5. Finish & OK

6
Creating a Project (2/5)
1. File  New
2. Location
Folder selection
3. Project Name
4. OK
5. Finish & OK

7
Creating a Project (3/5)
1. File  New
2. Location
3. Project Name
Hello
4. OK
5. Finish & OK

8
Creating a Project (4/5)
1. File  New
Win32 Console Application
2. Location
3. Project Name
4. OK
5. Finish
& OK

9
Creating a Project (5/5)
 Hello project is created

10
Adding Files (1/3)
1. File  New
Files tab
C++ Source File
2. filename
3. OK

11
Adding Files (2/3)
1. File  New
2. filename
Add to project
hello.c
3. OK

12
Adding Files (3/3)
 Source file hello.c is added to Hello project

13
File Edit

14
Compile & Build
 compile  Compile hello.c

 Object file (.obj) is created


 Build  Build Hello.exe

 Link : link object files and create a executable file (.exe)


15
Compile-time error

 Grammar error. Object file can not be created


 Double click error message line

16
Programming Process
Source files (.c)

preprocessor

temporary program texts

compiler

Object files
library files
linker

Executable file (.exe)

17
gcc / g++
 Free C/C++ compiler developed by GNU

18

You might also like