The Unix Environment and Compiling. Getting Set Up Your programs will be compiled and tested on the Departmental server ‘linprog’ The linprog servers.

Slides:



Advertisements
Similar presentations
Client-server practices DSC340 Mike Pangburn. Agenda Overview of client-server development Editing on client (e.g., Notepad) or directly on server (e.g.,
Advertisements

Linux, it's not Windows A short introduction to the sub-department's computer systems Gareth Thomas.
Learning Unix/Linux Bioinformatics Orientation 2008 Eric Bishop.
Introduction to the gedit editor. gedit: the Gnome editor Gnome: Gnome is a freely available (i.e., no cost) desktop environment for the UNIX system The.
Dayu Zhang 9/8/2014 Lab02. Example of Commands pwd --- show your current directory This is home of venus, not your home directory Tilde: means you are.
Introducing the Command Line CMSC 121 Introduction to UNIX Much of the material in these slides was taken from Dan Hood’s CMSC 121 Lecture Notes.
T UTORIAL OF U NIX C OMMAND & SHELL SCRIPT S 5027 Professor: Dr. Shu-Ching Chen TA: Samira Pouyanfar Spring 2015.
CS1020: Intro Workshop. Topics CS1020Intro Workshop Login to UNIX operating system 2. …………………………………… 3. …………………………………… 4. …………………………………… 5. ……………………………………
Dayu Zhang 9/3/2014 Lab01. Lab Instructor: Dayu Zhang Office Hour Mon/Wed 10:40am – 11:10am Room A201 Lab Website
1 SEEM3460 Tutorial Unix Introduction. 2 Introduction What is Unix? An operation system (OS), similar to Windows, MacOS X Why learn Unix? Greatest Software.
A crash course in njit’s Afs
Using Macs and Unix Nancy Griffeth January 6, 2014 Funding for this workshop was provided by the program “Computational Modeling and Analysis of Complex.
Overview of Linux CS3530 Spring 2014 Dr. José M. Garrido Department of Computer Science.
Help session: Unix basics Keith 9/9/2011. Login in Unix lab  User name: ug0xx Password: ece321 (initial)  The password will not be displayed on the.
Unix Primer. Unix Shell The shell is a command programming language that provides an interface to the UNIX operating system. The shell is a “regular”
CSE 390a Editing and Moving Files
1 Intro to Linux - getting around HPC systems Himanshu Chhetri.
Linux environment ● Graphical interface – X-window + window manager ● Text interface – terminal + shell.
Essential Unix at ACEnet Joey Bernard, Computational Research Consultant.
Agenda User Profile File (.profile) –Keyword Shell Variables Linux (Unix) filters –Purpose –Commands: grep, sort, awk cut, tr, wc, spell.
Unix Basics Chapter 4.
1 SEEM3460 Tutorial Unix Introduction. 2 Introduction Unix-like system is everywhere Linux Android for smartphones Google Chrome OS for Chromebook Web.
AN INTRO TO UNIX/LINUX COMMANDS BY: JIAYANG WANG.
PROGRAMMING PROJECT POLICIES AND UNIX INTRO Sal LaMarca CSCI 1302, Fall 2009.
Intro. To Unix commands For those who’ve never used Unix before Quick tutorial to let you move around your Unix Accounts No discussion of inner workings.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 6 System Calls OS System.
ENEE150 – 0202 ANDREW GOFFIN Introduction to ENEE150.
Getting started: Basics Outline: I.Connecting to cluster: ssh II.Connecting outside UCF firewall: VPN client III.Introduction to Linux IV.Intoduction to.
COP3502: Introduction to Computer Science Yashas Shankar.
Introduction to UNIX Geraint Vaughan. What is UNIX? Command-line operating system (not point- and click) Designed for ‘experts’ Lots of different variants.
Basic Unix Commands CGS 3460, Lecture 6 Jan 23, 2006 Zhen Yang.
1 Remote Access Telnet Telnet FTP FTP. 2 Applications and Communications Telnet Telnet  Program for accessing systems remotely.  Available on Windows.
Intro to Programming Environment 1. Today You Will Learn how to connect to a machine remotely with “nomachine NX client” Learn how to create a new “source.
Text Editing February 2 nd, 2004 Class Meeting 3.
Introduction To UNIX. FAQReferencesSummaryInfo Resources Introduction Learning Objectives Log on User Interface Commands List of Commands Useful Info.
Moving and Copying Text Instructor: Glenda H. Easter ITSW 1401, Intro to Word Processing.
Introduction to Programming Using C An Introduction to Operating Systems.
Object Oriented Programming COP3330 / CGS5409.  Assignment Submission Overview  Compiling with g++  Using Makefiles  Misc. Review.
Unix Servers Used in This Class  Two Unix servers set up in CS department will be used for some programming projects  Machine name: eustis.eecs.ucf.edu.
AN INTRO TO UNIX/LINUX COMMANDS BY: JIAYANG WANG.
Linux A practical introduction. 1)Background and Getting Started Linux is an operating system with multiple providers Red Hat/CentOS (our version) Ubuntu.
 Last lesson, the Windows Operating System was discussed along with the Windows command shell  Unix is a computer operating system, that similarly manages.
Intro. To Unix commands For those who’ve never used Unix before Quick tutorial to let you move around your Unix Accounts No discussion of inner workings.
Learning basic Unix command It 325 operating system.
Object Oriented Programming COP3330 / CGS5409.  Compiling with g++  Using Makefiles  Debugging.
Linux Tutorial Lesson Two *Getting Help in Linux *Data movement and manipulation *Relative and Absolute path *Processes Note: see chapter 1,2,3 from Linux.
CS 120 Extra: The CS1 Server Tarik Booker CS 120.
Object Oriented Programming COP3330 / CGS5409.  Assignment Submission Overview  Compiling with g++  Using Makefiles  Misc. Review.
Assignprelim.1 Assignment Preliminaries © 2012 B. Wilkinson/Clayton Ferner. Modification date: Jan 16a, 2014.
Review Why do we use protection levels? Why do we use constructors?
Overview of Linux Fall 2016 Dr. Donghyun Kim
Precept I : Lab Environment, Unix, Bash, Emacs
ENEE150 Discussion 01 Section 0101 Adam Wang.
UNIX To do work for the class, you will be using the Unix operating system. Once connected to the system, you will be presented with a login screen. Once.
How to Work on your METEO 473 codes from your PC at home
Tutorial of Unix Command & shell scriptS 5027
CS1010: Intro Workshop.
Web Programming Essentials:
Andy Wang Object Oriented Programming in C++ COP 3330
Compilation and Debugging
Compilation and Debugging
Part 3 – Remote Connection, File Transfer, Remote Environments
Tutorial of Unix Command & shell scriptS 5027
Tutorial of Unix Command & shell scriptS 5027
Lab 10 Instructions You can use g++ on build server, visual studio on local machine or your preferred C++ IDE. Important Note: For your grade, please show.
Web Programming Essentials:
Tutorial of Unix Command & shell scriptS 5027
Andy Wang Object Oriented Programming in C++ COP 3330
Tutorial Unix Command & Makefile CIS 5027
SPL – PS1 Introduction to C++.
Presentation transcript:

The Unix Environment and Compiling

Getting Set Up Your programs will be compiled and tested on the Departmental server ‘linprog’ The linprog servers (actually 4 computers) are maintained by the CS Systems Group and you must acquire an account for access (instructions here)here

Accessing linprog from a PC You should download 2 programs: SSH client – This program provides a secure connection to the server through which you can type terminal commands. SSH (Secure Shell) is a generic name for said service, a free windows SSH client can be found herehere X11 client - allows a server (such as linprog) to draw windows on your screen via an established SSH connection instead of solely using the terminal. A free trial of an X11 client Xwin32 can be found here and instructions on its use herehere

Accessing linprog from a Mac OS X has SSH and X11 clients built in. To access linprog with X11 active: Open ‘Terminal’ Application Type ‘ssh -X When setting up new account type ‘ssh

Basic Unix Commands ls – list files and directories in current directory cd - change current directory to cd.. – change directory to next up in hierarchy cd ~ - change directory to your home directory mkdir - create sub-directory in current directory rm – remove file rm –R – remove directory and all its subdirectories cat - output text of to screen more - similar to cat, allows scrolling man - displays manual page for various unix and programming concepts

Emacs Emacs is a powerful Unix text editor that you can use to edit your programs on linprog Type ‘emacs ’ to open/create file for editing If X11 is running, you may type ‘&’ at the end of the command to retain terminal access while emacs is running (‘&’ is the background modifier for Unix commands)

Emacs Tips In the windows SSH client, you may want to edit the preferences to send delete when backspace is typed or backspace will not work as intended You can use ctrl-k to cut multiple lines an ctrl-y to paste them ctrl-x-s is used to save the file (Hold ctrl, type x and release, type s and release) ctrl-x-c quits emacs ctrl-g aborts a command if you find emacs has ‘frozen’ ctrl-s allows you to search the file for a keyword You can find other emacs commands herehere

Transferring Files To/From Server On a PC: The SSH client has a built in file transfer utility Connect to linprog, click the File Transfer Utility button on the SSH client, your machines files are on the left, linprog’s file system is on the right, you may drag and drop files back and forth On a Mac: To copy files to linprog type ‘scp linprog.cs.fsu.edu:~/’ To copy files from linprog type ‘sftp linprog.cs.fsu.edu’ and then ‘get ’

Using Multiple Files for a Project Although any program can be written in a single file, we often separate a program into several files: Header File – contain class declaration, ends in.h (circle.h) Implementation File – contains class definition (class member function implementations), ends in.cpp (circle.cpp) Driver File – contains main() and possibly other subroutines used in the program, ends in.cpp (driver.cpp) All of the programs in this class will have the above format

Reasons For Using Multiple Files Allows changes to the class implementation without affecting the class interface/structure Allows a class to be used in multiple driver programs Increases the opportunities for code reuse Code becomes more modularized It is infeasible to code a large project in a single file

Compilation Compilation is the process of transforming C++ source code into an executable file We will view compilation as two stages: Compile Stage Linking Stage

Compile Stage Performs preprocessor directives (#include, #define, etc.) Checks syntax of program (e.g. missing semicolon) Checks if functions/variables declared before use Doest NOT check if functions that are used are defined Creates machine code representation of file known as an object file (term not associated with ‘object-oriented’) An object file is not executable and may have functions that are used but have no definition (implementation) example?

Linking Stage Links the object code into an executable program. May involve one or more object code files. The linking stage is the time when function calls are matched up with their definitions, and the compiler checks to make sure it has one, and only one, definition for every function that is called. All member functions must also be defined There must be a main() function

Compiling a Multi-File Project See circle.h, circle.cpp, and driver.cpp g++ -c circle.cpp // performs compile stage on circle.cpp and creates object file circle.o g++ -c driver.cpp // performs compile stage on driver.cpp and creates object file driver.o g++ circle.o driver.o –o driver// links object files into executable file ‘driver’

#include In the previous example we did not compile circle.h, how was the Circle class declaration included in the compilation? Remember that preprocessor directives like #include are handled in the first part of the compile phase ‘#include 'filename' is literally replaced with the contents of the file ‘filename’ To avoid problems, only #include with header files We can run the preprocessor only by running the 'cpp' command

Review Describe what happens in the compile phase. What g++ compiler flag is used to only perform the compile phase on a file? What is the output? Describe what happens in the linking stage. What is needed for an executable to be created? Name some reasons for using multiple files for a project. sample1.cpp