Title: Microsoft
1Microsofts Visual Studio and Visual C
2A similar Microsoft productThe Office Umbrella
- Microsoft Office is an umbrella container for a
number of applications - Word
- Access
- Powerpoint
- etc
3The Visual Studio umbrella
- When you install Visual C an integrated
development environment known as Developer Studio
is installed - Visual Studio supports
- Visual C
- Visual Basic
- Etc
- The number of potential project types you can
create depends on the number of Visual Studio
products you have installed. - Visual Studio is installed with your first
product (e.g. Visual C) and subsequent products
merely add more project options.
Visual C IDE
4Setting Options for Visual C
5Telling Visual C to start off where you left
off last time
6Seeing what options are already set
1
2
3
72
1
4
3
We can see where Visual C looks for the
standard library header files such as ltiostreamgt
8Using Visual C
- Concepts
- Projects
- Workspaces
9Projects
- A project refers to the complete list of files
needed to build an executable program. - Well mainly be using the
- Win32 Console Application
- Win32 Application
10Workspaces
- A project workspace (aka workspace) is simply a
folder under which additional subfolders and
files related to the project are stored. - Note A single workspace can contain multiple
projects
Project 1
Project 2
Workspace
11Note You can shortcut this by simply creating a
new project directly.
12Compiling and Linking
- Create a source file
- Compiling
- Linking and how to create an executable file
13Note Add to project is ticked!
Adding source code with File New.
14Aside
1
2
3
(1) If you want you can create a new file without
naming it or adding it to the project. (2) Write
your code and then save it into some
directory (3) Finally insert it into the project
by right-clicking and selecting the appropriate
menu item
152
1
- Notice
- My new C file is now part of the project
- As I type my code I can call Code Assist with
CTRL SPACEBAR
161
2
3
- When I enter my code I can then
- Compile the source code. This will produce a
binary file called Driver.obj - Build my executable. This will link in all the
appropriate binary code from the libraries and
produce chap1_ex1.exe (Note same name as the
project !!) - Run my new chap1_ex1.exe application
171
2
3
- This is what my project looks like in Windows
Explorer. Please notice - My source code Driver.cpp is in the root folder
C\c\2005\chap1_ex1 - My executable chap1_ex1.exe is in the Debug
sub-folder! Well see what this is the case in
the next slides. - My object file Driver.obj is also in that folder
18What are all these files for ?
File Extension Description
.dsp In previous versions of Visual C this was called .mak file. This file contains information about how your program is to be created from the files in the workspace. This file is automatically generated when you create a project workspace.
.dsw This file contains information about the workspace itself such as which projects it contains.
.ncb This file contains browse information about the entities (classes, global variables etc) in the project. Used by the IDE to help to navigate through your code.
.plg This is a log file for your project
.opt This file contains the settings for your workspace. This includes information about the appearance of the workspace when you re-open the project at some other time
.opt Created by Visual C when you shut the project down
19What are all these files for ?
File Extension Description
.exe This is the executable file for the program. You only get this file if both the compile and link steps are successful
.ilk This file is used by the linker when you rebuild your project. It enables the linker to incrementally link the object files produced from the modified source code into the existing . exe file. This avoids the need to re-link everything each time you change your program.
.pch This is a pre-compiled header file. With pre-compiled headers, large tracts of code which are not subject to modification (particularly code supplied by Visual C) can be processed once and stored in the . pch file. Using the . pch file substantially reduces the time needed to build your program.
.pdb This file contains debugging information that is used when you execute the program in debug mode. In this mode, you can dynamically inspect information that is generated during program execution.
.obj The compiler produces these object files containing machine code from your program source files. These are used by the linker, along with files from the libraries, to produce your . exe file.
.idb Contains additional debug information
20Why the Debug folder??
- How to configure how Visual C creates an
executable
211
2
You can set a range of options that tell Visual
C how you would like to happen when your source
code is being compiled and linked The set of
options that produces a particular executable
program is called a configuration
22When you create a project workspace Visual C
will automatically create configurations for
producing two versions of your application ?
Debug (contains lots of Debug information) ?
Release (provides most efficient code) You can
add other configurations as you require.
23You can see which type of code Visual C will
automatically produce with Build Set Active
Configuration Here we see that Visual C will
automatically produce executables bloated with
debug information.
242
1
3
4
When my code is working and Ive finished
debugging I (1) and (2) Set active configuration
to release and rebuild my project (3) Note a new
Release subfolder (4) Note a smaller sized
executable file called chap1_ex1.exe in that
folder (52K against debug version of 221K)
25Intro to Visual C from Deitel
- For additional information see
- http//www.deitel.com/books/cppHTP4/DiveIntoVCPP6.
zip