CS 261 Recitation 1 Compiling C on UNIX

Similar documents
Oregon State University School of Electrical Engineering and Computer Science. CS 261 Recitation 1. Spring 2011

Intermediate Programming, Spring Misha Kazhdan

CS CS Tutorial 2 2 Winter 2018

Warmup. A programmer s wife tells him, Would you mind going to the store and picking up a loaf of bread? Also, if they have eggs, get a dozen.

SECTION 2: CODE REASONING + PROGRAMMING TOOLS. slides borrowed and adapted from Alex Mariakis and CSE 390a

Lecture 01 - Working with Linux Servers and Git

Introduction to the Linux Command Line

CS480. Compilers Eclipse, SVN, Makefile examples

Introduction to Linux. Fundamentals of Computer Science

Lab 1 Introduction to UNIX and C

Intro to Linux & Command Line

Linux and Git Boot Camp

Exercise 1: Basic Tools

Parallel Programming Pre-Assignment. Setting up the Software Environment

CS Lab 1 Linux/Shell Basic commands Introduction. Teaching Assistant Henrique Potter

Introduction to Linux Environment. Yun-Wen Chen

Section 2: Developer tools and you. Alex Mariakakis (staff-wide)

Unit 10. Linux Operating System

C++ Programming on Linux

GIT Princípy tvorby softvéru, FMFI UK Jana Kostičová,

Lab Objective. Lab Assignment. Downloads and Installation

CpSc 1111 Lab 1 Introduction to Unix Systems, Editors, and C

Carnegie Mellon. Linux Boot Camp. Jack, Matthew, Nishad, Stanley 6 Sep 2016

Version Control with Git

Introduction to the UNIX command line

1. Git. Robert Snapp

The Command Shell. Fundamentals of Computer Science

CMPT 300. Operating Systems. Brief Intro to UNIX and C

213/513/613 Linux/Git Bootcamp. Cyrus, Eugene, Minji, Niko

User Guide Version 2.0

Lab 1 1 Due Wed., 2 Sept. 2015

Eugene, Niko, Matt, and Oliver

TNM093 Practical Data Visualization and Virtual Reality Laboratory Platform

Lab 1 Introduction to UNIX and C

Introduction: What is Unix?

Introduction to Supercomputing

CSCE UVM Hands-on Session-1 Pre-Work

Git. CSCI 5828: Foundations of Software Engineering Lecture 02a 08/27/2015

CS 246 Winter Tutorial 1

New User Tutorial. OSU High Performance Computing Center

Recitation #1 Unix Boot Camp. August 29th, 2017

Recitation #1 Boot Camp. August 30th, 2016

CMSC 104 Lecture 2 by S Lupoli adapted by C Grasso

Git Guide. Meher Krishna Patel. Created on : Octorber, 2017 Last updated : October, More documents are freely available at PythonDSP

Git. Charles J. Geyer School of Statistics University of Minnesota. Stat 8054 Lecture Notes

Unit 13. Linux Operating System Debugging Programs

Tutorial 2 GitHub Tutorial

CSE 351. Introduction & Course Tools

CSE 15L Winter Midterm :) Review

Software Development I

Development Environment & Linux Guide

UoW HPC Quick Start. Information Technology Services University of Wollongong. ( Last updated on October 10, 2011)

Using the Unix system. UNIX Introduction

EECS Software Tools. Lab 2 Tutorial: Introduction to UNIX/Linux. Tilemachos Pechlivanoglou

Effective Software Development and Version Control

CS 3410 Intro to Unix, shell commands, etc... (slides from Hussam Abu-Libdeh and David Slater)

CS 215 Fundamentals of Programming II Spring 2019 Very Basic UNIX

2 Initialize a git repository on your machine, add a README file, commit and push

Terminal Windows, Emacs, Subversion and Make

Introduction to Unix The Windows User perspective. Wes Frisby Kyle Horne Todd Johansen

LAB #5 Intro to Linux and Python on ENGR

Section 1: Tools. Kaifei Chen, Luca Zuccarini. January 23, Make Motivation How... 2

Lecture 1. A. Sahu and S. V. Rao. Indian Institute of Technology Guwahati

Setting up GitHub Version Control with Qt Creator*

Session 1: Accessing MUGrid and Command Line Basics

CSCI 2132: Software Development. Norbert Zeh. Faculty of Computer Science Dalhousie University. Subversion (and Git) Winter 2019

9 and 11-Jan CSCI 4152/6509 Natural Language Processing Lab 1: FCS Computing Environment, SVN Tutorial. FCS Computing Environment, SVN Tutorial

Linux Survival Guide

Computer Science Design I Version Control with Git

Git & Github Fundamental by Rajesh Kumar.

Laboratory Assignment #3 Eclipse CDT

For Dr Landau s PHYS8602 course

Unix Workshop Aug 2014

ENERGY 211 / CME 211. Evolution

Beyond this course. Machine code. Readings: CP:AMA 2.1, 15.4

CS 2400 Laboratory Assignment #1: Exercises in Compilation and the UNIX Programming Environment (100 pts.)

CS Fundamentals of Programming II Fall Very Basic UNIX

COSC UNIX. Textbook. Grading Scheme

Gradle and Command Line Workshop Activity

How to version control like a pro: a roadmap to your reproducible & collaborative research

CSCI 2132 Software Development. Lecture 5: File Permissions

AMS 200: Working on Linux/Unix Machines

CS 390 Software Engineering Lecture 5 More Git

Setting up my Dev Environment ECS 030

Modern C++ for Computer Vision and Image Processing. Igor Bogoslavskyi and Cyrill Stachniss

Projects and Environment Introduction

Introduction of Linux

AN INTRODUCTION TO UNIX

You should see something like this, called the prompt :

Linux Introduction Martin Dahlö

CS314 Software Engineering Configuration Management

CS 460 Linux Tutorial

Linux Tutorial. Ken-ichi Nomura. 3 rd Magics Materials Software Workshop. Gaithersburg Marriott Washingtonian Center November 11-13, 2018

Software Revision Control for MASS. Git Installation / Configuration / Use

Managing Projects with Git

Working with GIT. Florido Paganelli Lund University MNXB Florido Paganelli MNXB Working with git 1/47

Git. Presenter: Haotao (Eric) Lai Contact:

Introduction to Supercomputing

HW2d Project Addenda

Source Code Management wih git

Transcription:

Oregon State University School of Electrical Engineering and Computer Science CS 261 Recitation 1 Compiling C on UNIX Winter 2017

Outline Secure Shell Basic UNIX commands Editing text The GNU Compiler Collection (gcc) CS 261 Data Structures 2

Secure Shell Tools Mac OS X / Linux Open a terminal Type ssh [username]@[server] ssh kuleszto@flip.engr.oregonstate.edu scp [file] [username]@[server] Windows Transmit, Cyberduck, Filezilla, etc. (if you want a GUI) Putty (http://it.engineering.oregonstate.edu/accessingunix-server-using-putty-ssh) MobaXterm WinSCP (http://winscp.net/) CS 261 Data Structures 3

Putty Configuration [username]@[server] Server name Save the connection Open a saved connection CS 261 Data Structures 4

WinSCP Configuration [server] [username] Save the connection CS 261 Data Structures 5

WinSCP Usage Drag and drop to upload/download files Your computer Server CS 261 Data Structures 6

UNIX Servers @ OSU ENGR flip.engr.oregonstate.edu (RHEL 6.5) flop.engr.oregonstate.edu (RHEL 6.5) ONID shell.onid.oregonstate.edu (Debian 6.0) CS 261 Data Structures 7

Outline Secure Shell Basic UNIX commands Editing text The GNU Compiler Collection (gcc) Setting up your IDE Basic debugging CS 261 Data Structures 8

Basic UNIX Commands Command ls cd [dir name] pwd mkdir [dir name] rmdir [dir name] cp [file] [new file] mv [file] [new file] rm [file] cat [file] exit ctrl-c Description Lists files and folders (use ls -l for a long listing) Change directory ( cd.. will go up a directory) Print name of current directory Make a directory Remove a directory Copy a file (use cp r to copy a directory) Move (or rename) a file or directory Remove a file Show file contents Close connection to server Kill the current process CS 261 Data Structures 9

Basic UNIX Commands For more info on a command, use the manual page: $ man ls Tutorial: http://www.ee.surrey.ac.uk/teaching/unix/

Outline Secure Shell Basic UNIX commands Editing text The GNU Compiler Collection (gcc) Setting up your IDE Basic debugging CS 261 Data Structures 11

UNIX Text Editors Nano Easiest choice Command: nano [filename] ctrl-o to save file ctrl-x to exit Emacs Amazingly powerful, steep learning curve Command: emacs [filename] ctrl-x ctrl-s to save file ctrl-x ctrl-o to exit http://www2.lib.uchicago.edu/keith/tcl-course/emacstutorial.html CS 261 Data Structures

Outline Secure Shell Basic UNIX commands Editing text The GNU Compiler Collection (gcc) Setting up your IDE Basic debugging CS 261 Data Structures 13

GCC GCC is the standard UNIX/Linux/Mac OS X compiler for about a dozen languages (e.g., C, C++, Objective C, Fortran, Java) Compiling with GCC: gcc <list of options> sourcefile.c e.g.: gcc -Wall -std=c99 -o test test.c Compiling multiple files: gcc <list of options> <list of source files> e.g.: gcc Wall -std=c99 -o test test1.c test2.c test3.c CS 261 Data Structures 14

Makefile Example A makefile is like a script for the compiler. We ll provide makefiles for many of your assignments so you ll be able to compile by typing make. Contents of a makefile: default:main Executed when you type make main: main.c gcc -Wall std=c99 main.c o main clean: rm main main.o Executed when you type make clean CS 261 Data Structures 15

Make Tutorial http://mrbook.org/tutorials/make/ CS 261 Data Structures 16

Outline Secure Shell Basic UNIX commands Editing text The GNU Compiler Collection (gcc) Setting up your IDE Basic debugging CS 261 Data Structures 17

C Programming IDEs Mac/Linux/Windows: Eclipse CDT Mac only: Xcode Windows only: Visual Studio Note: Eclipse CDT does not come with a C/C++ compiler and Windows does not have a built-in C/C++ compiler either (Linux and Mac usually come with GCC installed). Therefore, using Eclipse CDT on Windows requires installation of a compiler first, for example MinGW. See http://www.eclipse.org/downloads/moreinfo/c.php for more info. CS 261 Data Structures 18

Always Test on UNIX! You can use any IDE to develop and test your C application before submitting. However, UNIX is the environment in which the program will be graded. Make sure your program will compile and run without errors or warnings using GCC on flip.engr.oregonstate.edu. CS 261 Data Structures 19

GIT Usage www.github.com Any questions on obtaining the assignments? git clone username@host:/path/to/repository Add & commit git add <filename> git add * (not recommended with executables) git commit m Commit Message This only commits to local computer! CS 261 Data Structures 20

GIT Usage -git remote v Chck status of remote git remote add origin <git repository link> Configure remote connection git pull origin master It adds the branch info to gitconfig file Use it only first time while setting the new branch or in case of fetch head error while git push. git pull is more preferred command. git pull Pulls the remote changes into local repository git push origin master This pushes to the network repository CS 261 Data Structures 21

GIT Usage Branching Git allows to create many branches of a working repository Useful for testing new ideas while preserving the HEAD code Create new branch: git checkout b <branch_name> Revert to master: git checkout master Delete the branch git branch d <branch_name> Push branch to remote server git push origin <branch_name> CS 261 Data Structures 22

GIT Usage Update and merge git pull Fetches and merges remote changes Git always trys to auto-merge In cases of failure, you will be notified conflicts Edit files manually to resolve conflicts Delete one version and all the auxiliary characters Then git add and commit again CS 261 Data Structures 23

GIT GUI Invoked from git gui CS 261 Data Structures 24

That s all for today! CS 261 Data Structures 25