Editing - PowerPoint PPT Presentation

1 / 14
About This Presentation
Title:

Editing

Description:

Build: Get it to compile and run. Debug I: find and fix syntax errors. Debug II: find and fix semantic errors (testing) ... documentation can be poor. IDEs ... – PowerPoint PPT presentation

Number of Views:57
Avg rating:3.0/5.0
Slides: 15
Provided by: andrewjp5
Category:
Tags: editing | ides

less

Transcript and Presenter's Notes

Title: Editing


1
Editing Compiling UNIX vs. IDE and an Intro to
Architecture
2
Outline
  • Announcements
  • Homework I on web, due Fri., 5PM by e-mail
  • Basic computer architecture
  • Creating code
  • Compiling code
  • Integrated Development Environments

3
Development Process
  • Design
  • Specification
  • Build Prototype
  • Implementation write the code
  • Build Get it to compile and run
  • Debug I find and fix syntax errors
  • Debug II find and fix semantic errors (testing)
  • Improve performance through tuning or re-design

4
Build Process
  • Write code
  • Pass to compiler
  • Compiler creates an executable--a binary file
    with low-level instructions equivalent to your
    high-level program
  • Run the executable

5
Compiling Linking
  • Compiling consists of two steps
  • Translating high-level language to machine code
  • Many ways to translate same commands
  • Some ways may have better performance
  • Linking bits of machine code together to form an
    executable
  • Even simple programs are not self contained
  • You can call routines like sin, printf, or
    write but you dont have to include code for
    these functions in your program
  • Rather, built-in functions have already been
    translated and are stored in object files
    somewhere on the system
  • Compiler must get the machine code and bundle
    with your executable

6
Compiling Linking
cc prog.c -oprog
Transnslation
Link
7
Basic Development on UNIX
  • A note on UNIX
  • UNIX is a powerful, elegant, and simple OS
  • For many years, UNIX systems were THE systems for
    scientific work
  • Windows is eating away, but UNIX systems are
    still common
  • I will typically discuss UNIX tools first and
    then examine analogous tools on Windows
  • The UNIX tools are typically more general and
    were the inspiration for the Windows analogs

8
Basic Development on UNIX
  • First thing we need is a text editor
  • vi--terminal editor. Very basic editor that you
    control solely through the keyboard (no mousing)
  • useful for fixing small bugs, editing input files
  • I wouldnt want to write more than a few lines,
    though
  • Emacs--classic UNIX word processor. Lots of
    people love emacs, but Im not one of them
  • NEdit--worlds greatest text editor
  • Mac/PC like interface,
  • good syntax highlighting (can be easily modified
    and customized)
  • Efficient searching/replace (possible to use
    regular expressions)
  • column cut and paste!

9
Basic Development on UNIX
  • Next, we need to compile
  • Compilers are specific to
  • programming languages (sort of)
  • Operating Systems/processors (definitely)
  • For a given language/system combination there are
    often several compilers
  • differ by price GNU vs. commercial
  • differ by performance

10
Basic Development on UNIX
  • Compiling on UNIX
  • cc ltoptionsgt ltcode filesgt -oltexecutable namegt
  • compiler name might change (gcc, cc, f77, f90),
    but the format is usually the same
  • typical options
  • -o name the executable (otherwise, a.out)
  • -O perform some basic performance optimizations
  • -O2 perform some more dramatic optimizations
  • -c compile to object code (dont link)
  • -g enable debugging
  • -l ltnamegt link to library libltnamegt.a
  • -w inhibit warnings

11
Basic Development on UNIX
  • Running the program
  • just type the name (assumes . is in path)
  • if that doesnt work, type ./name

12
Basic Development on Windows
  • Editors
  • Free stuff like Notepad, Wordpad
  • NEdit
  • MSWord (but why?)
  • Compilers
  • most will work from a DOS prompt in a UNIX-like
    fashion
  • key difference is that you use /ltoption rather
    than -ltoptiongt

13
Basic Development on Windows
  • Although you can do things from a DOS prompt,
    most Windows programming is done in an Integrated
    Development Environment (IDE)
  • CodeWarrior
  • VisualStudio
  • Also ProjectBuilder (Mac), KDev (Linux)
  • What are they integrating?
  • combine editor, compiler, and debugger

14
IDEs
  • Much easier to use, just edit and push a button
    to compile and run
  • can often click on compiler error messages and go
    right to the line
  • set compiler options through menus
  • Main disadvantage disconnected from compiler
  • often, finding compiler options is hard and
    usually just like the command line
  • documentation can be poor
Write a Comment
User Comments (0)
About PowerShow.com