System Programming - LAB 1 Programming Environments.
-
Upload
elfreda-fletcher -
Category
Documents
-
view
215 -
download
1
Transcript of System Programming - LAB 1 Programming Environments.
![Page 1: System Programming - LAB 1 Programming Environments.](https://reader036.fdocuments.us/reader036/viewer/2022082711/56649ef15503460f94c01885/html5/thumbnails/1.jpg)
System Programming - LAB
1Programming Environments
![Page 2: System Programming - LAB 1 Programming Environments.](https://reader036.fdocuments.us/reader036/viewer/2022082711/56649ef15503460f94c01885/html5/thumbnails/2.jpg)
General information
•Niccolo` Battezzati (
• web site: www.cad.polito.it/staff/battezzati
(teaching section)
• LABs schedule: WEDNESDAY 8:30 - 12:30
(LABINF)
![Page 3: System Programming - LAB 1 Programming Environments.](https://reader036.fdocuments.us/reader036/viewer/2022082711/56649ef15503460f94c01885/html5/thumbnails/3.jpg)
Windows Programming
•MS Visual Studio 2005
•IDE for Windows programming in several languages (C/C++ for us) with support for Win-32 APIs
•Project-based programming
![Page 4: System Programming - LAB 1 Programming Environments.](https://reader036.fdocuments.us/reader036/viewer/2022082711/56649ef15503460f94c01885/html5/thumbnails/4.jpg)
MS Visual Studio•To create a new project:
1.Win-32 API Console Application
2.C++ / Empty project
•Advices:
1.#include <windows.h> in each file that uses Win-32 APIs
2.#undef UNICODE before including <windows.h>
3.you can write both C and C++ code
![Page 5: System Programming - LAB 1 Programming Environments.](https://reader036.fdocuments.us/reader036/viewer/2022082711/56649ef15503460f94c01885/html5/thumbnails/5.jpg)
Unix Programming
•Many different IDEs (Eclipse C/C++, Anjuta, Dev-C++, KDevelop)...
•... but also text-editor + makefiles
![Page 6: System Programming - LAB 1 Programming Environments.](https://reader036.fdocuments.us/reader036/viewer/2022082711/56649ef15503460f94c01885/html5/thumbnails/6.jpg)
Makefiles
•Basics:
1.for each target there are compilation rules
2.rules are simple compilation commands
3.variables can be defined to improve generalization
4.use standard targets for good-practice programming
![Page 7: System Programming - LAB 1 Programming Environments.](https://reader036.fdocuments.us/reader036/viewer/2022082711/56649ef15503460f94c01885/html5/thumbnails/7.jpg)
Makefiles - syntax
target: [dependencies]
rules
Any simple identifier
Compilation commands (gcc ...)(can use variables)
other targets that you need to execute first
YOU MUST INSERT a TAB SPACE!!!
![Page 8: System Programming - LAB 1 Programming Environments.](https://reader036.fdocuments.us/reader036/viewer/2022082711/56649ef15503460f94c01885/html5/thumbnails/8.jpg)
Makefiles - example 1
SRC = main.c
compile:
gcc $(SRC) -o my_first_program
![Page 9: System Programming - LAB 1 Programming Environments.](https://reader036.fdocuments.us/reader036/viewer/2022082711/56649ef15503460f94c01885/html5/thumbnails/9.jpg)
Makefiles - standard targets
•all: executes all the targets to perform compilation
•clean: removes temporary files (objects, etc.)
•distclean: removes also the executables
![Page 10: System Programming - LAB 1 Programming Environments.](https://reader036.fdocuments.us/reader036/viewer/2022082711/56649ef15503460f94c01885/html5/thumbnails/10.jpg)
Makefiles - example 2
CC = gcc
SRC = main.c hello.c
EXE = hello
all: compile
compile:
$(CC) $(SRC) -Wall -o $(EXE)
clean:
rm -f *.o
distclean: clean
rm -f $(EXE)
variables definition
targets and rules
![Page 11: System Programming - LAB 1 Programming Environments.](https://reader036.fdocuments.us/reader036/viewer/2022082711/56649ef15503460f94c01885/html5/thumbnails/11.jpg)
Access to shared locations
•On Windows:
1.Tools -> Map Network drive...
2.insert the share folder: \\cclix1\corsi\system-programming
•On Linux:
1./export/home/corsi/system-programming