Download presentation
Presentation is loading. Please wait.
Published byScott Harrell Modified over 9 years ago
1
Cygwin Linux for Windows Desktop Paul Stuyvesant
2
Introduction Various tools available to work with Linux –Knoppix - boot from CD –Dual Boot PC –Download a full distro from a vendor Cygwin requires no financial investment –No impact on existing system –Free!
3
Introduction Will give developers a ‘heads up’ to Linux Familiarise them with: –File structure –Simple Commands –gcc and g++
12
Icon created on the desktop Linux file structure created on disk Directories holding ‘mirror’ information Click on icon to start Cygwin Using Cygwin
13
Running Cygwin
16
No concept of filetypes in Linux –Can make it confusing initially Developer can use.c and.cpp if they wish It is a good idea to set standards –Enforce the standards company wide Overview
17
List directory contents ls ls -a ls -l ls -la Filenames that being. are ‘hidden’ Each user has ‘home’ directory –Indicated by ~ on display Basic Commands
19
Create a new directory mkdir progs mkdir ~/progs2 Change directory cd progsChange to progs directory cd ~Change to home directory cd /Change to root directory cd ~/progsChange to progs via home Basic Commands
21
Not usually downloaded by default. Go back to Cygwin website and rerun setup. Choose gcc/g++ from the various packages –Can sometimes be difficult to find –Can download both executable and source –Usually some dependencies Installing gcc/g++
24
Standard Linux/Unix tools are not great emacs vi vim Get hold of a decent text editor My recommendation is Textpad Editing Files
25
Try before you buy Relatively cheap Files saved as either DOS or Unix format Built in macros, or create your own Excellent search facility in the tool Active user community on the net Infinitely customisable Textpad
26
Part of the GNU toolchain Portable compiler that runs on most platforms available Can produce output for many types of processors Can be used as a cross compiler –Generates executable for different system gcc
27
No concept of filetypes in Linux Developer can use.c and.cpp if they wish –It is a good idea to set standards at the outset By default gcc creates an executable file –Called a.out or a.exe –Someone thought it was a good idea –Various options to override default name gcc
28
gcc first.c –Compiles and links first.c –Creates an executable called a.out or a.exe gcc –Wall first.c –Compile/link first.c with common warnings –Recommended you always use this option gcc –Wall first.c –o first –Creates executable called first or first.exe Compile and Link
30
gcc –Wall –c first.c –Create object file called first.o –Does not link or create executable gcc –Wall –c first.c hello.c –Create object file for each source file –first.o and hello.o Compile
31
gcc first.o hello.o –o paulprog –Create executable file called paulprog.exe –Inputs are first.o and hello.o gcc first.o../Paulobj/hello.o –o paulprog –Use object file in different directory –Build program from a variety of object Link
32
User written headers should be in quotes Specify where the header is located –#include “paul.h” Current Dir –#include "Hdrs/paul.h“Specified Dir Can create Paths so directory is not required –C_INCLUDE_PATH=~/C_Progs/Hdrs –export C_INCLUDE_PATH –CPLUS_INCLUDE_PATH=~/CPP_Progs/Hdrs –export CPLUS_INCLUDE_PATH Headers
33
Used to compile C++ code Most parameters the same as gcc Code checking is tighter than gcc –Program compiled OK in gcc may get errors with g++ Nearly all C programs are valid C++ programs –Simply recompile using g++ g++
34
If you want to use Linux read up about –File and Directory Permissions –Aliases –Shell and Environment Variables –Startup files –Pipes –Makefiles Further Topics
35
g++/gcc are part of powerful toolset –Free download, easy to install –Quick and (relatively) easy to work with Large amount of help on www –Sometimes too much Get ahead of the game – try it now Summary
36
THE END Thanks for staying awake Enjoy the rest of the conference A copy of presentation will be available at www.pcs-training.co.uk/downloads.htm Any questions drop me a line at paul@pcs-training.co.uk
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.