CST8152 Compilers Creating a C Language Console Project with Microsoft Visual Studio.Net 2005

Similar documents
CST8152 Compilers Creating a C Language Console Project with Microsoft Visual Studio.Net 2010

CST8152 Compilers Creating a C Language Console Project with Microsoft Visual Studio.Net 2003

TREX Set-Up Guide: Creating a TREX Executable File for Windows

Opening Microsoft Visual Studio. On Microsoft Windows Vista and XP to open the visual studio do the following:

WRITING CONSOLE APPLICATIONS IN C

Visual C++ Tutorial. For Introduction to Programming with C++ By Y. Daniel Liang

Introduction. Key features and lab exercises to familiarize new users to the Visual environment

Using OpenGL & GLUT in Visual Studio.NET 2003

Module 3: Working with C/C++

Creating Mixed Language Projects with Microsoft Developer Studio 2005, Intel Fortran, MS C++ and Canaima Legacy Software

Creating a MOM 2005 Peformance Graph Report From a Template

Creating a new CDC policy using the Database Administration Console

Applied ICT Skills MS Windows

IMPLEMENTING SCL PROGRAMS. Using Codeblocks

HOW TO USE CODE::BLOCKS IDE FOR COMPUTER PROGRAMMING LABORATORY SESSIONS

Using the Dev C++ Compiler to Create a Program

Prototype User Guide Public Release Version 1

Using Eclipse for C, MPI, and Suzaku

CodeWarrior Development Studio for Advanced Packet Processing FAQ Guide

How to debug Wcem.dll with.net Studio

Compiling MapleSim C-Code in Visual C Express

Lab 1: Introduction to C Programming. (Creating a program using the Microsoft developer Studio, Compiling and Linking)

APPENDIX A. CODE COMPOSER STUDIO (CCS) v5: A BRIEF TUTORIAL FOR THE DSK6713

Engr 123 Spring 2018 Notes on Visual Studio

Building AMD64 Applications with the Microsoft Platform SDK. Developer Application Note

EM L13 Preparing Applications to Virtualized and Streamed Hands-On Lab

Pursuit 7 for Windows

JUCE TUTORIALS. INTRO methodology how to create a GUI APP and how to create a Plugin.

As CCS starts up, a splash screen similar to one shown below will appear.

ECE 103 In-Class Exercise L1 Guide

Netherworks Studios. Start DAZ Studio 3 and simply navigate to "NWS Scripts" in your content folder. Run the "Activate Folder Favorites" script.

Using Eclipse for Java. Using Eclipse for Java 1 / 1

Parallel Printers Set-Up

RVDS 4.0 Introductory Tutorial

Windows NT Server Printer Driver Upgrade Instructions

Developing Applications using Universal Driver 6.0x in Windows CE 6.0

Configuring Visual Studio 2017 with SFML Game Engine

EECE.2160: ECE Application Programming Spring 2018 Programming Assignment #1: A Simple C Program Due Monday, 1/29/18, 11:59:59 PM

UNic Eclipse Mini Tutorial (Updated 06/09/2012) Prepared by Harald Gjermundrod

Code Composer Studio Operation Manual

DEVELOPING OOSIML SIMULATION MODELS. Using Codeblocks

Welcome Application. Introduction to C++ Programming (Solutions) 2004 by Deitel & Associates, Inc. All Rights Reserved.

Where Did My Files Go? How to find your files using Windows 10

Creating Pages with the CivicPlus System

OOSIML SIMULATION MODELS. On Windows and Linux

As CCS starts up, a splash screen similar to one shown below will appear.

MS Visual Studio.Net 2008 Tutorial

Optional Eclipse Workspace Configurations

Module 4: Working with MPI

BASICS OF THE RENESAS SYNERGY PLATFORM

Exercise 7-1 Preparing Files for Distribution

INFORMATICS LABORATORY WORK #2

RVDS 3.0 Introductory Tutorial

APPLICATION COMMON OPERATING ENVIRONMENT (APPCOE)

Ticket Mail Merge Instructions for MS Word 2007 and 2010

CodeWarrior Development Studio for Power Architecture Processors FAQ Guide

DOMAIN TECHNOLOGIES. Getting Started Guide Version 1.1. BoxView IDE. Integrated Development Environment

CPE 323: Laboratory Assignment #1 Getting Started with the MSP430 IAR Embedded Workbench

Scientific Software Development with Eclipse

Check the Desktop development with C++ in the install options. You may want to take 15 minutes to try the Hello World C++ tutorial:

WORKING WITH SHARED FOLDERS IN WINDOWS 7

Test/Debug Guide. Reference Pages. Test/Debug Guide. Site Map Index

dotdefender for IIS Installation Guide

First Steps with Visual FlagShip 8 for MS-Windows

General Guidelines: SAS Analyst

At the shell prompt, enter idlde

EDEM Dynamics Coupling Quick Start Guide

CSCI 161: Introduction to Programming I Lab 1b: Hello, World (Eclipse, Java)

4H4Me Announcement Letter

Targeting the NetWare Operating System PDK 5.0

HPC on Windows. Visual Studio 2010 and ISV Software

IT Essentials v6.0 Windows 10 Software Labs

TOP SERVER V5 CLIENT CONNECTIVITY ROCKWELL FACTORYTALK VIEW STUDIO. Table of Contents

3. Hello World! for IDEA. Java. Summer 2008 Instructor: Dr. Masoud Yaghini

Appendix M: Introduction to Microsoft Visual C Express Edition

For additional information, please consult the Read-Me and Help documentation or contact Electro-Voice or Dynacord technical support.

You have a PC with a USB interface, running Microsoft Windows XP (SP2 or greater) or Vista You have the Workshop Installation Software Flash Drive

Business Insight Authoring

Developing Intelligent Apps

Evaluation Guide - WebSphere Integration

TE100-P1P/TE100-P1U F.A.Q.

USING CODEBLOCKS. Implementing Computational Models

and 32 bit for 32 bit. If you don t pay attention to this, there will be unexpected behavior in the ISE software and thing may not work properly!

How To Download And Install MapPro for Networks

Perceptive Interact for EpicCare Link

Injector. Windows Server NRG Global, Inc.

Using CodeWarrior V4.5 Assembler with Adapt9S12X and Serial Monitor

Use Vivado to build an Embedded System

Session 10 MS Word. Mail Merge

Installing Eclipse CDT and MinGW

Integrated Information Technology Services (IITS)

Faber 6000/Faber 6000 Plus USB Driver Installation for Windows 7/10

Lab 4: Introduction to Programming

Getting started with the Xilinx Project Navigator and the Digilent BASYS 2 board.

Eclipse Quick Reference Windows Hosted

Installing and getting started with Visual Studio for C programming in Windows.

Dealing with Event Viewer

USB-Link Technical Guide

Quick Start Guide ZedboardOLED Display Controller IP v1.0

OpenLM Agent Installation V and Up

Transcription:

CST8152 Compilers Creating a C Language Console Project with Microsoft Visual Studio.Net 2005 The process of creating a project with Microsoft Visual Studio 2005.Net is similar to the process in Visual Studio 2003.Net, but Microsoft added a few more options and changed the user interface at some places. To create a C Language Console Project, you should follow the steps outlined below. 1. Getting Started Launch Microsoft Visual Studio.Net 2005. After the flash screen disappears you should be presented with the Microsoft Development Environment [design] window. Depending on the installation configuration the window can contain different views. By default it should display the Start Page view. If the Start Page is missing, you can invoke it from the main menu bar opt for Window, Show Start Page or View, Other, Start Page. The screen could look a bit different from the one shown in Figure 1 if you have already created some projects they will be listed in the Projects tab list. You can also see some other views displayed. Figure 1. Microsoft Development Environment Start Page view displayed. CST8152 Compilers Page 1 of 11

2. Creating a project - Selecting a Project Type Selectr File, New, Project from the main menu bar. The following New Project window should appear as shown in Figure 2. Select Visual C++ in the left pane (Project Types) and Win32 Console Application in the right pane (Templates). Enter the name of the project in the Name text filed, for example, cdtypes. Choose the location of the project, for example, C:\Compiler\Lab0 or better N:\Compiler\Lab0. Uncheck Create directory for solution check box. Click OK. The Win32 Application Wizard should appear as shown in Figure 3. Figure 2. Selecting the Project Type and Naming the Project. 3. Creating a project - Selecting an Application Type In the Win32 Application Wizard click the Application Settings on the left. The Application Wizard window should change as shown in Figure 3a. CST8152 Compilers Page 2 of 11

Figure 3. Selecting Console Application. Make sure Console application is selected as an Application type. Uncheck the Precompiled header and check Empty project under Additional options as shown in Figure 3a. Click Finish. The Solution Explorer view should appear on the right. If not, choose View, Solution Explorer from the main menu. Figure 3a. Selecting Console Application. CST8152 Compilers Page 3 of 11

In the Solution Explorer view window you should see your project node tree. It contains three folders: Source Files, Header Files, and Resource Files as shown in Figure 4.If you try to open some of the folders, you will find that they are empty. You can remove the Resource Files node. Select Resource Files, right-click, select Remove and confirm with OK. You can also close the Start Page. Figure 4. An Empty Project If you do not like the name of the project, you can change it. Simply select Solution, right-click, select Rename and type the new name of the project. Then, select the cdtypes project node, right-click, select Rename and type the new name. 4. Setting the Project Properties Before setting the project properties a C/C++ program file must be added first. Otherwise C/C++ option will not be visible in the right pane of the Project Properties window. Section 5 explains in details how to add a new or existing file. To add a new file you should right click on the Source Files folder (or on the project name cdtypes) and select Add, Add New Item. Select Code in the right pane, and C++ File in the left pane. Type the name of the file in the Name: text field. The file extension must be.c. Click the Add button at the bottom. The program editor view should appear on the right. The next step is to set the project properties. Select Project, Properties from the main menu (or right-click on cdtypes project name and select Properties. The Property Pages window should appear as shown in Figure 5. On the left side you will see the Configuration Properties tree. The currently selected property is highlighted in grey. On the right side you can see the default settings. When the window opens the CST8152 Compilers Page 4 of 11

General property should be selected by default (see Figure 5.). Clicking on the + icons you can expand the tree node and choose and configure different setting of your project as shown below with the C/C++ node expanded. Figure 5. The Property Pages Window. To change a configuration parameter (or property) you must select the corresponding line, click on the pull-down list icon to reveal the list of allowed options, and select the appropriate one as shown in Figure 6. Figure 6 show how to change the Character Set property to Not Set. Once you are done with the page, you should click Apply and move to the next page. CST8152 Compilers Page 5 of 11

Figure 6. Configuration Properties, General changing a property. 4.1. Changing the C/C++ Project Properties (settings) Click on the + icon in front of the C/C++ node. The C/C++ property nodes will appear as shown in Figure 7. Select the General property page. In Figure 7 the default Warning Level property - Level 3 (/W3) is changed to Level 4 (/W4). No changes are required in Optimization, Preprocessor, Code Generation, Precompiled Headers, Output Files, and Browse Information. You can peruse the property pages for further reference. CST8152 Compilers Page 6 of 11

Figure 7. C/C++ Property Pages Warning level changed in General Go to Language, select Disable Language Extension and select Yes(/Za) as shown in Figure 8. This will force the compiler to be ANSI C compliant, and if your program contains any non ANSI C language statements (extensions) the compiler will generate syntax errors or warnings. For example, if you have C++ type single line comments (//), they will generate warnings like the one shown bellow CST8152 Compilers Page 7 of 11

Figure 8. Making the compiler ANSI compliant. Move to the Advanced page. Change Compile As from Compile as C++ Code (/TP) to Compile as C Code (/TC) as shown in Figure 9. Figure 9. Forcing the C++ compiler to work as a C language compiler. Take a look at the Command Line option. Do not change anything there. CST8152 Compilers Page 8 of 11

4.2. Changing the Linker Project Properties No any changes are required for the Linker Properties. In Linker, General you can change the name of the executable file which will be generated by the linker. Note: If you want to change the name of the project (output exe file) you must make the change in Linker, General, Output File using the <Edit > option. Explore the Linker properties. 4.3. Changing the Other Project Properties You can explore the rest of the property pages, but there is no need to change any of the default setting for this particular project. So click Apply and OK to finish with the project properties configuration. Select File, Save All to save the project settings. 5. Adding Source Code to your Solution (Project) To add a C program to your project, select Source Files in Solution Explorer pane, right-click, select Add. Now you have the option to add a new program file or an existing program file as shown in Figure 10. If you program or header file dos not exist, you can add a new item to your project. Select Add New Item and in the Add New Item window select Code folder icon on the left, select the C++ File or Header File on the right, type the name of your source file in the Name text filed as shown in Figure 12. Click Add and the file will be added to your project (Figure 11) and an empty program editor will appear on the screen. If it has not, double click the cdtypes.c program file name. You can type your program now. If you program has been already written, before performing the add operation, you should copy the file into the project directory. After selecting Add Existing Item the Add Existing Item window will appear and you can select the c-file from the list. Click Add and the file will be added as a subnode to your Source Files folder as shown in Figure 11. Now you can start working with your program. Figure 10. Adding a Source Code Item Figure 11. A Program is Added to the Project. CST8152 Compilers Page 9 of 11

Figure 12. Adding a New Source File. 5. Compiling a C program In Solution Explorer select the C file you want to be compiled, right-click and select Compile. The result of the compilation will be shown in the Output view. The Compile action creates an object file only, not an executable. Pay attention to the warnings. 6. Building a Project To build a project means to make a request to the IDE to compile all your project files (c and h) and to link the compilation results (the obj file) into an executable (.exe). To build a project, select the project node (for example, cdtypes) in Solution Explorer view, right-click, and select Build. You can use the Build option from the main menu for the build the project (or the solution).the results from the building process will be reported in the Output view. If the operation of building the project is successful, an executable file will be created in your project Debug directory. Pay attention to the warnings. 7. Running the Program You can run your program within the IDE, or as a stand alone program from the command prompt in a Command Prompt (DOS or console) window. CST8152 Compilers Page 10 of 11

To run the program within the IDE, select Debug, Start Without Debugging (Ctrl+F5). The result of the execution will be shown in an application window. If your program requires command line arguments, you must specify them in the Project properties, Configuration Properties, Debugging properties page. To run the program from the command prompt (which is the normal way of invoking a console application) you need to open a Command Prompt window. To open a Command Prompt window Start, Run, type cmd or command, and click OK. Once you have the command prompt window opened, use the cd command to navigate to your project Debug directory, type the name of your executable (for example, cdtypes) and the command line arguments and press Enter. Now it is time to close the Net and count the fish. Enjoy it. S^R, 2009 CST8152 Compilers Page 11 of 11