View Single Post
Old 03-20-2003, 11:34 AM   #1 (permalink)
Valmont
[code][/code] enforcer
 
Valmont's Avatar
 
Join Date: Mar 2003
Location: Netherlands
Posts: 1,545
Valmont is on a distinguished road
Installing and using CMUgraphics library.

revision 1

Preface:
This topic covers a stepwise instruction on how to install and enable the CMUgraphics library in Visual C++ 6 Enterprise edition. This might also work on Learning editions and Pro editions as well, but I couldn't test that.

I offer the starter the correct files (in zip) to download (library) and a project (folder in zip) I made for demonstrational purposes. The project is an unfinished enterprise, dedicated to another thread in this C++ forum (started by Z~).
The relevant thread is located here:.Original thread

Downloading files
- You can download the required CMUgraphic library, header and C/C++ files from my site:
CMUgraphics for VC++
And for the Library it self (required too):
CMUGraphicsLibVC6.lib

Note: I have no idea if it is legal to distribute this library. I strongly encourage correct judicial behaviour when it comes to programming, therefore I appologise if any mis-doing from my side. Once I receive a "no-go", I will remove this file immediatly from my site.

- You can download my project files from:
HelpHIm.zip
This file is intended to give answers to Z~. Anyone might be interested too if one starts to use CMUgraphics and is perhaps a novice C++ programmer.

Discovering the downloaded required packages
1) Unzip the VC-graphics.zip folder to a temporary folder. Lets call this temporary folder: VC-TEMP.
2) Take a peek in VC-TEMP. You will see another folder called CMUgraphicsLib. That is the one we need. The rest are files for demonstrational purposes made by third parties.
3) Take a peek in the "CMUgraphicsLIb" folder. You will discover Header and C++ files. There are also C and Header files in the jpeg folder. We need all of them.
4) You have also downloaded the CMUGraphicsLibVC6.lib file. You will need this one too.

Preparing folders and files before configuring VC6
We will now make 4 folders. One main CMU folder to hold 3 sub-folders. The 3 sub-folders will contain the lib, source and header files.
1) Make a main folder to hold 3 sub-folders. Example:
E:\CustomProgrammingTools\CMU
The CMU folder is the main folder.
2) Make 3 sub-folders in CMU:
E:\CustomProgrammingTools\CMU\include
E:\CustomProgrammingTools\CMU\lib
E:\CustomProgrammingTools\CMU\source
3) We will now copy files to folders.
a) Copy ALL header files to this new "include" folder.
b) Copy ALL C/C++ files to this new "source" folder.
c) Copy "CMUGraphicsLibVC6.lib" to this new "lib" folder.

You have done the most intellectual part now. Next step is to configure VC++6 so it can handle CMU too.

Configuring VC++6
We will now setup VC++6 in such way, so it can find the CMU library and files too. It will not change the current behaviour of VC++6! You will only ADD features, but NOT remove anything, like macros or other functionality.

1) Start up Visual C++ 6. No need to open/start projects.
2) Goto "Tools->Options...->Directories".
3) Click on dropdown box "Show directories for:" and choose:
a) "Include files" then point to your very new include sub-folder.
b) "Library files" then point to your very new lib sub-folder.
c) "Source files" then point to your very new source sub-folder.

Note: Once you select the drop down box and select (for example) "Include files", you will see a dotted box in the little white window. Double-click on that. Then a "folder chooser" will appear to the right of it. Just click on the folder chooser and point to the corresponding folder. It is that simple.
DO NOT MODIFY ANYTHING. YOU ONLY NEED TO ADD STUFF.

You have now completed everything! Next step is to demonstrate on how to begin a default CMU project. There is a small pitfall.

Starting a new CMUgraphics-related project
1) Start up VC++6.
2) Goto "File->new...->Win32 Console Application".
3) Make a project name and choose to make no files at all.
4) You are now in the IDE without any files. Goto "File->New...->Files" and select the C++ file. Name it "main.cpp".
5) In "main.cpp", add your header files like <iostream.h> but also this code:
#include <CMUgraphics.h>
6) Pitfall here: Goto "Project->Add To Project->Files..".
7) Select the file "CMUGraphicsLibVC6.lib" located in your very new lib sub-folder.

You are now done!!!! Have fun if you like CMU. I don't lol.

Using HelpHim.zip.
This is nothing more but a zipped folder containing the project files that gives answers to a thread located in this C++ forum.
It is functional, demonstrating basic issues. It also contains lots of comments to help the student move on.

1) Unzip it anywhere you like.
2) Go in the unzipped folder and doubleclick on the *.dsw file.
VC++6 will start up, holding this project with all its files and dependancies.
3) Delete the library file in the project window by selecting it and then pressing the DELete key.
4) Add the CMUGraphicsLibVC6.lib again by going to "Project->Add To Project->Files..".
Select the file "CMUGraphicsLibVC6.lib" located in your very new lib sub-folder.
5) Run the program. The IDE will compile first.

Run the program and click on the upper left button. And click again. The lil box (button) will change colors, and the window title outputs the coordinates of the last mouse click.
End program by pressing the ESC button anytime and then click twice (not double-click) on the main (colored) window.

Proggie demonstrates the use of the ESC button, setting up simple objects and color schemes, mouse inputs and text output in the window-title bar. It also gives hints to basic naming conventions in the main.cpp files.

That is it folks. If you need me I'm right here :th: .
Valmont is offline   Reply With Quote