Project structure
We recommend that you create your buffer manager project as follows:
Assume the skeleton code is copied to the following two directories
:
z:\cs432\globaldefs\*.[Ch] <=== Contains all the source
codes needed to make static library "globaldefs.lib"
(Actually, "bufmgr.h" is not there,
I'll talk about this later)
z:\cs432\Proj1\*.[Ch]
<=== Contains all the source codes for the Bufmgr.
Inside Visual C++:
Create a "Win32 Console Application" (we call ours "Proj 1").
-
Go to File menu click on New.
-
In the menu that pops out, you must select "Win32 Console Application"
(we named ours "Proj 1").
-
Now our workspace is created.
Create a "Win32 Static Library", add it to current workspace making it
a dependency of "Proj1".
-
Go to File menu click on New
-
In the menu that pops out, you must select "Win32 Static Library", add
it to current workspace and make it a dependency of "Proj1". (we named
our Static Library "globaldefs")
Add files to project "Proj1" and "globaldefs"
-
Go to Project menu, set Active workspace to globaldefs
-
Go to Project Menu click on Add files to project
-
Add source files in z:\cs432\globaldefs to project "globaldefs",
-
Set Active workspace to Proj1
-
Add source files in z:\cs432\Proj1 to project "Proj1". (Make sure every
header file exists in only one of these two directories, to avoid possible
inconsistency.)
You must change the "Settings" for project 'Proj1" and "globaldefs", to
include the directories where the header files are located. For example,
"globaldefs" will include "bufmgr.h", which locates at \Proj1. So, you'll
add flag "/Iz:\cs432\Proj1" to the Project option of "globaldefs". This
can be done as following:
-
Go to Project Menu click on Settings
-
Click on the C/C++ tab
-
Select "globaldefs"
-
add the flag "/Iz:\cs432\Proj1" to the Project Options of "globaldefs"
-
Repeat procedure but this time add the directory "/Iz:\cs432\globaldefs"
to the Project Options of "Proj1".
Now you are ready to change
the code and build the application, you can begin by opening the bufmgr.cpp
file in your project.
If you don't know how to do any steps explained above, the fastest
approach is to check Visual C++ online help or ask your neighbor.