CIS 403: Lab 1: Editing and Compiling

Total Page:16

File Type:pdf, Size:1020Kb

CIS 403: Lab 1: Editing and Compiling CIS 403: Lab 1: Editing and compiling Getting Started 1. Follow the directions to create an ACCEL account. 2. Every other computer should boot into Linux. To do this, click on “shutdown” and then select “restart.” The computer will begin restart- ing. You will eventually have the option to select either Win2K or Linux (use up and down arrows to switch, press enter to select). Linux Basics 1. You should find a partner: one of you should be sitting in front of a machine running Windows, the other in front of Linux. Log into your respective machines. Then, both of you should turn your attention to the Linux machine. 2. UNIX comes in several “flavors”–Linux is an increasingly popular ver- sion that is available on many platforms. Most UNIX systems can be controlled by pointing and clicking in a windowing system (typically based on X-Windows), but all UNIX systems can be controlled by en- tering commands at a command line. We’ll focus our work on this level. To get a command line, open the Terminal application by clicking on the icon at the bottom (it looks like a black TV screen). There are hundreds of UNIX commands, but you can get by only know- ing a few: 1 pwd “Print Working Directory”–tells you where you are. ls “LiSt directory”–tells you what’s in your current directory. mkdir “MaKe Directory”–mkdir name creates a directory called name. cd “Change Directory”–cd path moves you to path. cp “CoPy”–cp path1 path2 creates a copy of the file at path1 at path2. mv “MoVe”–mv path1 path2 changes the name of the file (or directory) at path1 to path2 rm “ReMove”–rm file deletes the file 3. To get started, type pwd to view your current directory. You should be in your home directory (/home/CUID). You can easily return to your home directory by typing cd ∼. Create a directory to hold our first program by typing mkdir FirstLinux. Type ls to verify that the directory was created. Move into this directory: cd FirstLinux. 4. I’ve placed the code for a simple C-program on the course website. To get this file, open a web-browser (Netscape) by typing netscape & (the & tells the computer to return control to the command line, otherwise, we would have to quit netscape to enter additional commands). Navigate to the course website 1 and download “firsttry.c.” You should save this file in FirstLinux. 5. Examine the contents of firsttry.c by opening it in a text editor. You may use whatever editor you like, but I recommend KWrite. To launch KWrite, type kwrite &. KWrite has menus similar to most Windows programs. Find “open” and open firsttry.c. Look through the code an make sure you understand what it is doing (I’ve included lots of comments). 6. To compile firsttry.c, type gcc firsttry.c at the command line. Type ls to list the contents of your directory. You should see a file called a.out, this is your program. To run it, just type a.out. Delete a.out when you’re done. 1www.cs.cornell.edu/Courses/cs403/2003sp 2 7. For the sake of practice, make a few changes to firsttry.c and recompile. Try changing the message, the values in array, the size of array, or the way that array is printed. 8. This program is simple enough that it won’t really show off many cool compiler options; however, there are two that I’d like you to try. First, type gcc firsttry.c -c and then ls. Instead of creating a.out, this creates an object file firsttry.o. To build the executable, we must linkfirsttry.o with the built-in C-functions. Fortunately, gcc will do this automat- ically: type gcc firsttry.o. You should now have a.out and it should work the same as before. The name a.out is pretty stupid (the creators of UNIX were good programmers, but pretty boring folks). To create an executable with a more meaningful name, use the -o option: gcc firsttry.o -ofirsttry. Note: we could create firsttry from the source code in one step by typing gcc firsttry.c -ofirsttry, but this would take longer than just linking the object file. 9. We’re done with UNIX for today, so logout and reboot to Windows. To logout, click on the menu button at the lower left and select “lo- gout.” When the login screen appears, click on “Shutdown” and then “Restart.” Windows Basics 1. Turn your attention to a Windows machine. I assume that everyone is familiar with Windows, if both you and your partner are not, please let me know. Your home directory is mounted as drive “S:.” 2. Launch “Microsoft Visual C/C++” from the application menu (lower left–it’s under “Microsoft Visual Tools”−→“MS Visual Studio 6.0”). This is Microsoft’s contribution to the world of programming, and it works about as well as most Microsoft products. In order to build an application, you first need to create a “Project.” A project is a collection of source code (possibly some libraries) and “configurations”– different ways of building your application. To create a project, select “New” from the “File” menu. Select “Win32 Console Application” from the window that appears. You should then change the location to your home directory (click on the ... icon and navigate), and then name the project “FirstWindows.” Click “OK” and a new screen will 3 appear. Be sure to select “empty project” at this screen and click ”Finish.” VizStudio will then create a directory “FirstWindows” with a file describing the project. 3. We need to get the source code for our program and add it to the project. To add firsttry.c to the project, go to “Project”−→“Add to Project”−→“Files.” Navigate to your “FirstLinux” directory, select firsttry.c, and hit return. 4. VizStudio combines and editor, compiler, and debugger. To edit our file, we need to select it from the list of files on the left. If you don’t see the file, select the “File” view by clicking on the tab at the bottom of the window, then click on the “+” beside the source folder. Double clicking on firsttry.c will open the file in an editor. 5. To build the application, select “Build” from the “Build” menu. This will create a file called “FirstWindows.exe” in the S:\FirstWindows\Debug. This executable runs from a DOS prompt (like a terminal in Linux). You can either open a DOS window, navigate to this directory and type FirstWindows, or you can select “Execute” from the “Build” menu. 6. It is possible to change how our application gets built by altering the configuration. When you create a new project, VizStudio creates two configurations: “Debug” and “Release.” By default, your current con- figuration is set to “Debug,” but you can select a different configuration (or create a new one) by going to “Build”−→“Set Active Configura- tion.” To change the settings on a configuration (compiler options, executable name) go to “Settings” under the “Project” menu. Play around with this menu and figure out how to change the name of the executable and how to have the compiler optimize for speed. 4.
Recommended publications
  • KDE 2.0 Development, Which Is Directly Supported
    23 8911 CH18 10/16/00 1:44 PM Page 401 The KDevelop IDE: The CHAPTER Integrated Development Environment for KDE by Ralf Nolden 18 IN THIS CHAPTER • General Issues 402 • Creating KDE 2.0 Applications 409 • Getting Started with the KDE 2.0 API 413 • The Classbrowser and Your Project 416 • The File Viewers—The Windows to Your Project Files 419 • The KDevelop Debugger 421 • KDevelop 2.0—A Preview 425 23 8911 CH18 10/16/00 1:44 PM Page 402 Developer Tools and Support 402 PART IV Although developing applications under UNIX systems can be a lot of fun, until now the pro- grammer was lacking a comfortable environment that takes away the usual standard activities that have to be done over and over in the process of programming. The KDevelop IDE closes this gap and makes it a joy to work within a complete, integrated development environment, combining the use of the GNU standard development tools such as the g++ compiler and the gdb debugger with the advantages of a GUI-based environment that automates all standard actions and allows the developer to concentrate on the work of writing software instead of managing command-line tools. It also offers direct and quick access to source files and docu- mentation. KDevelop primarily aims to provide the best means to rapidly set up and write KDE software; it also supports extended features such as GUI designing and translation in con- junction with other tools available especially for KDE development. The KDevelop IDE itself is published under the GNU Public License (GPL), like KDE, and is therefore publicly avail- able at no cost—including its source code—and it may be used both for free and for commer- cial development.
    [Show full text]
  • Catalogo De Apliciones Para Gnu/Linux
    Universidad Luterana Salvadoreña SOFTWARE LIBRE SOFTWARE LIBRE CATALOGO DE APLICIONES PARA GNU/LINUX AUTORES: RUBEN ERNESTO MEJIA CORTEZ MARVIN FERNANDO RAMIREZ DAVID ARMANDO CORNEJO SOFTWARE LIBRE INDICE Contenido Pagina Introducción .........................................................................................1 Objetivos ...............................................................................................2 Que es software libre ? ..........................................................................3 Editores de texto ....................................................................................6 Exploradores ..........................................................................................17 Correo Electrónico .................................................................................28 Editores de audio ...................................................................................40 Reproductores de audio ........................................................................51 Ofimática .................................................................................................61 Reproductores multimedia ......................................................................67 Editores de video .....................................................................................76 Compresores ...........................................................................................87 Creadores de CD'S ..................................................................................96
    [Show full text]
  • The Kate Handbook
    The Kate Handbook Anders Lund Seth Rothberg Dominik Haumann T.C. Hollingsworth The Kate Handbook 2 Contents 1 Introduction 10 2 The Fundamentals 11 2.1 Starting Kate . 11 2.1.1 From the Menu . 11 2.1.2 From the Command Line . 11 2.1.2.1 Command Line Options . 12 2.1.3 Drag and Drop . 13 2.2 Working with Kate . 13 2.2.1 Quick Start . 13 2.2.2 Shortcuts . 13 2.3 Working With the KateMDI . 14 2.3.1 Overview . 14 2.3.1.1 The Main Window . 14 2.3.2 The Editor area . 14 2.4 Using Sessions . 15 2.5 Getting Help . 15 2.5.1 With Kate . 15 2.5.2 With Your Text Files . 16 2.5.3 Articles on Kate . 16 3 Working with the Kate Editor 17 4 Working with Plugins 18 4.1 Kate Application Plugins . 18 4.2 External Tools . 19 4.2.1 Configuring External Tools . 19 4.2.2 Variable Expansion . 20 4.2.3 List of Default Tools . 22 4.3 Backtrace Browser Plugin . 25 4.3.1 Using the Backtrace Browser Plugin . 25 4.3.2 Configuration . 26 4.4 Build Plugin . 26 The Kate Handbook 4.4.1 Introduction . 26 4.4.2 Using the Build Plugin . 26 4.4.2.1 Target Settings tab . 27 4.4.2.2 Output tab . 28 4.4.3 Menu Structure . 28 4.4.4 Thanks and Acknowledgments . 28 4.5 Close Except/Like Plugin . 28 4.5.1 Introduction . 28 4.5.2 Using the Close Except/Like Plugin .
    [Show full text]
  • How to Check Your C Development Environment
    DIL/NetPC ADNP/1520 – microHOWTO How to check your C Development Environment The ADNP/1520 is powered by a 32-bit x86 microcontroller. The IA-32 microcontroller architecture and the ADNP/1520 default Linux operating system allows you to use the native GCC tool chain of a Linux-based PC for C/C++ software development. • 1. Step: Setup a Ethernet link between the ADNP/1520 and a PC system. Use a valid IP address for your PC. • 2. Step: Booting up the ADNP/1520 and use a Telnet console session. Login with administrator rights (user name: root, no password necessary). Change to the directory /home/gast within the ADNP/1520 Linux file system. • 3. Step: Use a text editor program (i.e. KWrite) on your Linux-based PC and write a simple “Hello World” program in C. Save your source code as hello.c. • 4. Step: Use the GCC of your PC Linux to build an executable file of your “Hello World”. Run the new executable on your PC. Use the following commands: gcc –o hello hello.c strip hello ./hello This command lines assumes, that hello.c is the file name of your “Hello World” C source file. The executable name is hello. The optional strip command produces a very small binary. SSV EMBEDDED SYSTEMS 2004, mHT1520A-10.doc, Rev. 1.00. 1 DIL/NetPC ADNP/1520 – microHOWTO • 5. Step: Transfer the executable with the help of a FTP session from the PC to the ADNP/1520. If you use a Linux distribution (i.e. a SuSE PC Linux) with KDE on your PC, it is possible to use the file manager Konqueror for this task.
    [Show full text]
  • Fedora 14 User Guide
    Fedora 14 User Guide Using Fedora 14 for common desktop computing tasks Fedora Documentation Project User Guide Fedora 14 User Guide Using Fedora 14 for common desktop computing tasks Edition 1.0 Author Fedora Documentation Project [email protected] Copyright © 2010 Red Hat, Inc. and others. The text of and illustrations in this document are licensed by Red Hat under a Creative Commons Attribution–Share Alike 3.0 Unported license ("CC-BY-SA"). An explanation of CC-BY-SA is available at http://creativecommons.org/licenses/by-sa/3.0/. The original authors of this document, and Red Hat, designate the Fedora Project as the "Attribution Party" for purposes of CC-BY-SA. In accordance with CC-BY-SA, if you distribute this document or an adaptation of it, you must provide the URL for the original version. Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert, Section 4d of CC-BY-SA to the fullest extent permitted by applicable law. Red Hat, Red Hat Enterprise Linux, the Shadowman logo, JBoss, MetaMatrix, Fedora, the Infinity Logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries. For guidelines on the permitted uses of the Fedora trademarks, refer to https://fedoraproject.org/wiki/ Legal:Trademark_guidelines. Linux® is the registered trademark of Linus Torvalds in the United States and other countries. Java® is a registered trademark of Oracle and/or its affiliates. XFS® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States and/or other countries.
    [Show full text]
  • Pipenightdreams Osgcal-Doc Mumudvb Mpg123-Alsa Tbb
    pipenightdreams osgcal-doc mumudvb mpg123-alsa tbb-examples libgammu4-dbg gcc-4.1-doc snort-rules-default davical cutmp3 libevolution5.0-cil aspell-am python-gobject-doc openoffice.org-l10n-mn libc6-xen xserver-xorg trophy-data t38modem pioneers-console libnb-platform10-java libgtkglext1-ruby libboost-wave1.39-dev drgenius bfbtester libchromexvmcpro1 isdnutils-xtools ubuntuone-client openoffice.org2-math openoffice.org-l10n-lt lsb-cxx-ia32 kdeartwork-emoticons-kde4 wmpuzzle trafshow python-plplot lx-gdb link-monitor-applet libscm-dev liblog-agent-logger-perl libccrtp-doc libclass-throwable-perl kde-i18n-csb jack-jconv hamradio-menus coinor-libvol-doc msx-emulator bitbake nabi language-pack-gnome-zh libpaperg popularity-contest xracer-tools xfont-nexus opendrim-lmp-baseserver libvorbisfile-ruby liblinebreak-doc libgfcui-2.0-0c2a-dbg libblacs-mpi-dev dict-freedict-spa-eng blender-ogrexml aspell-da x11-apps openoffice.org-l10n-lv openoffice.org-l10n-nl pnmtopng libodbcinstq1 libhsqldb-java-doc libmono-addins-gui0.2-cil sg3-utils linux-backports-modules-alsa-2.6.31-19-generic yorick-yeti-gsl python-pymssql plasma-widget-cpuload mcpp gpsim-lcd cl-csv libhtml-clean-perl asterisk-dbg apt-dater-dbg libgnome-mag1-dev language-pack-gnome-yo python-crypto svn-autoreleasedeb sugar-terminal-activity mii-diag maria-doc libplexus-component-api-java-doc libhugs-hgl-bundled libchipcard-libgwenhywfar47-plugins libghc6-random-dev freefem3d ezmlm cakephp-scripts aspell-ar ara-byte not+sparc openoffice.org-l10n-nn linux-backports-modules-karmic-generic-pae
    [Show full text]
  • Operating Systems II
    Operating Systems II Vimalkumar Velayudhan April 11, 2007 Vimalkumar Velayudhan Operating Systems II Linux distribution A Linux distribution is = The Linux kernel(OS) + Application software Popular ones are Company/Organization Commercial Version Open Source Version Redhat Redhat Enterprise Linux Fedora Core Novell SuSE Linux Enterprise openSuSE Debian - Debian GNU/Linux Mandriva Mandriva Corporate Desktop/Server Mandriva Linux Vimalkumar Velayudhan Operating Systems II Which One to Choose? If one requires technical support, the commercial versions are the best option Open Source versions are freely available for download and are often distributed with IT magazines like Linux For You1 and Digit2 For a new Linux user my recommendations are openSuSE or Ubuntu Linux 1http://www.linuxforu.com 2http://www.thinkdigit.com Vimalkumar Velayudhan Operating Systems II Installation Basic requirements Intel pentium systems I, II, III or IV (can even run on older ones) Minimum 256 MB RAM for a Graphic User Interface (KDE or GNOME) A hard disk - 5 - 10GB hard disk space Notes Linux can be installed along with Windows systems (Multiboot) Requires partitioning of the hard disk and formatting to ext2 or ext3 lesystems Linux can also read and write data on the windows partitions Vimalkumar Velayudhan Operating Systems II Live Linux Distributions Also known as Live CD's3 Does not require any installation onto hard disk Can run directly from the CD Can be used for learning and to try out new distributions Atleast 256 - 512MB RAM is required Some examples include Ubuntu, Knoppix and Slax Live CD's with Bioinformatics software pre-installed are also available. Examples include VLinux4, BioKnoppix, Vigyaan CD.
    [Show full text]
  • KDE E.V. Quarterly Report 2008Q1/Q2
    KDE e.V. Quarterly Report Q1/2008 & Q2/2008 .init() home for KDE e.V. to call its own but a tremendous asset in Claudia who Dear KDE e.V. member, has rapidly made herself at home in our community providing much needed logistical support and business The first two quarters of 2008 were very busy ones for development effort while diving head-first into the KDE participants. Both the technology project and KDE e.V. community by joining our events and tradeshow teams. We were bustling with activity. are happy to welcome Claudia into our community and our team. The obvious stand-out moment was when KDE 4.0 was released at an immensely successful release event held in In short, the first half of 2008 was busy and full of pleasant Mountain View, California - where Google served as our surprises and achievements. KDE e.V. found ways to be hosts and numerous locations around the world tuned in more efficient and increase our pace to keep up with the to join us live over the Internet. Besides creating new technology project's own escalation. Looking forward to community bonds and bringing together developers from the second half of the year with Akademy 2008 just around various projects and companies in and outside of the KDE the corner, it's safe to say that things aren't about to slow project, it also spawned what will be an annual KDE down, either. Americas event at the beginning of each year. To our membership and partners: thank you for helping Work to ensure Akademy 2008 went off successfully was making the start of 2008 such a positive and productive also in high gear as KDE 4.1 was being readied for release.
    [Show full text]
  • Linux Operations and Administration by Ahmad Alrjoub [email protected] Chapter Four Creating and Editing Files with Text Editors Objectives
    Linux Operations and Administration By Ahmad AlRjoub [email protected] Chapter Four Creating and Editing Files with Text Editors Objectives • Describe key features of GUI and command-line text editors available in Linux • Use the vim editor to create and edit text files Linux Operations and Administration 2 Text Editors in Linux • Text editor – Program used to create and edit plain text files – Not same as word processor – Main purpose: to create a file to be used by another program, for example: • Hypertext Markup Language (HTML) for a Web browser • Source code that a compiler can process • Shell script – Text file containing a sequence of commands Linux Operations and Administration 3 Text Editors in Linux (cont’d.) • Two types of text editors: – Command-line editors – GUI editors Linux Operations and Administration 4 GUI Text Editors in Linux • Linux GUI text editors – Similar to Notepad in Windows • Advantage: – Select and edit text quickly with the mouse • Widely used GUI text editors: – KWrite – Gedit Linux Operations and Administration 5 KWrite: A GUI Text Editor for KDE • Also called programmer’s editor for the K Desktop Environment • To start: – Type kwrite at a command prompt • Opens a new empty file in Kwrite – Use Kickoff Application Launcher button • Advanced features: – Syntax highlighting to display text in different colors and fonts for programming languages – Bookmarks are markers placed on certain lines to help navigate through a text file Linux Operations and Administration 6 KWrite: A GUI Text Editor for KDE (cont’d.)
    [Show full text]
  • Getting Started with Ubuntu and Kubuntu
    Getting Started With Ubuntu and Kubuntu IN THIS PART Chapter 1 The Ubuntu Linux Project Chapter 2 Installing Ubuntu and Kubuntu Chapter 3 Installing Ubuntu and Kubuntu on Special-Purpose Systems COPYRIGHTED MATERIAL 94208c01.indd 1 3/16/09 11:43:23 PM 94208c01.indd 2 3/16/09 11:43:24 PM The Ubuntu Linux Project ersonal computers and their operating systems have come a long way since the late 1970s, when the first home computer hit the market. At IN THIS cHAPTER that time, you could only toggle in a program by flipping switches on the P Introducing Ubuntu Linux front of the machine, and the machine could then run that program and only that program until you manually loaded another, at which time the first program Choosing Ubuntu was kicked off the system. Today’s personal computers provide powerful graph- ics and a rich user interface that make it easy to select and run a wide variety of Reviewing hardware and software concurrently. software requirements The first home computer users were a community of interested people who just Using Ubuntu CDs wanted to do something with these early machines. They formed computer clubs and published newsletters to share their interests and knowledge ​— ​and often the Getting help with Ubuntu Linux software that they wrote for and used on their machines. Sensing opportunities and a growing market, thousands of computer companies sprang up to write and Getting more information sell specific applications for the computer systems of the day. This software ranged about Ubuntu from applications such as word processors, spreadsheets, and games to operating systems that made it easier to manage, load, and execute different programs.
    [Show full text]
  • KDE 2.0 Development
    00 8911 FM 10/16/00 2:09 PM Page i KDE 2.0 Development David Sweet, et al. 201 West 103rd St., Indianapolis, Indiana, 46290 USA 00 8911 FM 10/16/00 2:09 PM Page ii KDE 2.0 Development ASSOCIATE PUBLISHER Michael Stephens Copyright © 2001 by Sams Publishing This material may be distributed only subject to the terms and conditions set ACQUISITIONS EDITOR forth in the Open Publication License, v1.0 or later (the latest version is Shelley Johnston presently available at http://www.opencontent.org/openpub/). DEVELOPMENT EDITOR Distribution of the work or derivative of the work in any standard (paper) book Heather Goodell form is prohibited unless prior permission is obtained from the copyright holder. MANAGING EDITOR No patent liability is assumed with respect to the use of the information con- Matt Purcell tained herein. Although every precaution has been taken in the preparation of PROJECT EDITOR this book, the publisher and author assume no responsibility for errors or omis- Christina Smith sions. Neither is any liability assumed for damages resulting from the use of the information contained herein. COPY EDITOR International Standard Book Number: 0-672-31891-1 Barbara Hacha Kim Cofer Library of Congress Catalog Card Number: 99-067972 Printed in the United States of America INDEXER Erika Millen First Printing: October 2000 PROOFREADER 03 02 01 00 4 3 2 1 Candice Hightower Trademarks TECHNICAL EDITOR Kurt Granroth All terms mentioned in this book that are known to be trademarks or service Matthias Ettrich marks have been appropriately capitalized. Sams Publishing cannot attest to Kurt Wall the accuracy of this information.
    [Show full text]
  • The Konqueror Handbook
    The Konqueror Handbook Pamela Roberts Developers: The KDE Team The Konqueror Handbook 2 Contents 1 Overview 6 2 Konqueror Basics7 2.1 Starting Konqueror . .7 2.2 The Parts of Konqueror . .8 2.3 Tooltips and What’s This? . .9 2.4 Left and Middle Mouse Button Actions . .9 2.5 Right Mouse Button Menus . 10 2.6 Viewing Help, Man and Info Pages . 11 3 Konqueror the File Manager 12 3.1 Folders and Paths . 12 3.2 View Modes . 12 3.2.1 File Tip Info . 13 3.2.2 File Previews . 13 3.2.3 Information in the View . 14 3.3 Folder View Properties . 14 3.3.1 The View Properties Dialog . 15 3.4 Navigation . 15 3.4.1 Finding Files and Folders . 16 3.4.2 Removable Devices . 16 3.5 Deleting Files and Folders . 17 3.6 Moving and Copying . 17 3.6.1 Using Drag ’n Drop . 18 3.6.2 Duplicate File or Folder Names . 18 3.7 Selecting Items in the View . 19 3.7.1 Selecting Items Using the Mouse . 19 3.7.2 Selecting Items Using the Keyboard . 19 3.7.3 Selecting Items Using the Menu . 20 3.8 Create New . 20 3.9 Changing Names and Permissions . 21 3.9.1 Copy and Rename . 21 3.10 Configuring File Associations . 22 3.11 At the Command Line . 22 The Konqueror Handbook 4 Konqueror the Web Browser 23 4.1 Connecting to the Internet . 23 4.2 Surfing and Searching . 24 4.3 Tabbed Browsing . 25 4.4 Web Shortcuts .
    [Show full text]