Programming:C++/Books/You Can Do It!: A Beginners Introduction to Computer Programming

From WhyAskWhy.org Wiki
< Programming:C++‎ | Books
Revision as of 19:11, 29 July 2012 by Deoren (talk | contribs) (Added make clean step just in case someone is coming back to these directions after previously building the library)
Jump to: navigation, search


These are my notes from You Can Program in C++: A Programmer's Introduction [1].


About the book

I'll attempt to give proper remarks for this book later, but suffice to say this book is well worth your time if you're learning C++. I like how Francis pays particular attention to the pitfalls of the language. He teaches you to always check for failing function calls (something a lot of "beginner books" fail to do) and teaches you how to use strings and vectors from the beginning in place of arrays.


What if you don't have the cd?

Before purchasing a copy of the book & CD, I checked out a copy of the book from a library and did not have the CD. This was ok because at the time the author made the contents available from his website. [2] Unfortunately the author's website hasn't been operational for some time, however on the same note the publisher has newer content available for download. [3]

At the time the author's website had a broken link to Quincy 2002, [4] but I was able to find Quincy 2005 [5] which is a newer version of it. Thankfully it is still available for download for those that want to use it. Since Francis Glassborow made the source for the FGW Library (aka, "Playpen") available, we can compile it using newer versions of MinGW or different compilers altogether. That's great because I like to use Netbeans and the current MinGW and plan on trying out Visual Studio as I'm going through the book.


Building the FGW library for use with Quincy 2005

Preparing to build the library

  1. Download Quincy 2005 v1.3 and install it, then proceed with the rest of the instructions.
  2. Download the windows_tutorial.zip file from the publisher's website for the book [3] and extract to a temporary location.
  3. Move all folders inside of windows_tutorial to C:\tutorial.
  4. Move all files from the C:\tutorial\source directory to the C:\tutorial\fgw_headers directory, choosing to overwrite existing files.
  5. Remove the C:\tutorial\source directory (should have nothing inside of it).
  6. Remove the C:\tutorial\libraries directory as we're going to build a newer library file. Aside from the volume serial number, you should see the following:
C:\tutorial>tree /F
Folder PATH listing
Volume serial number is 38B9-1B1A
C:.
├───chapter_1
├───chapter_10
├───chapter_11
├───chapter_12
├───chapter_13
├───chapter_14
├───chapter_15
├───chapter_16
├───chapter_17
├───chapter_18
├───chapter_2
├───chapter_3
├───chapter_4
├───chapter_5
├───chapter_6
├───chapter_7
├───chapter_8
├───chapter_9
└───fgw_headers
        adler32.c
        colournames.h
        deflate.c
        deflate.h
        fgw_text.h
        flood_fill.cpp
        flood_fill.h
        infblock.c
        infblock.h
        infcodes.c
        infcodes.h
        inffast.c
        inffast.h
        inffixed.h
        inflate.c
        inftrees.c
        inftrees.h
        infutil.c
        infutil.h
        keyboard.h
        libfgw.a
        line_drawing.cpp
        line_drawing.h
        makefile
        minipng.cpp
        minipng.h
        mouse.h
        playpen.cpp
        playpen.h
        point2d.cpp
        point2d.h
        point2dx.cpp
        point2dx.h
        shape.cpp
        shape.h
        trees.c
        trees.h
        winplaypen.gpj
        zconf.h
        zlib.h
        zutil.c
        zutil.h

Building the library

  1. Copy C:\Program Files\quincy\MinGW\lib\libgdi32.a to C:\tutorial\fgw_headers\libgdi32.a and replace any existing copy if it exists.
  2. Open a command prompt (Start->Run->cmd->Enter)
  3. set path=%path%;C:\Program Files\quincy\MinGW\bin
  4. cd C:\tutorial\fgw_headers
  5. mkdir C:\tutorial\fgw_headers\Release
  6. bash
  7. make clean
  8. make
  9. Every time the book tells you to add fgwlib.a to your project, reference C:\tutorial\fgw_headers\libfgwlib.a instead.

Building the fgw library using the latest MinGW and MSYS tools

These steps assume you've previously built the library and already have the tutorial.exe contents extracted and the library source files updated. I'll need to clean up these directions so they make better sense.


  1. Download and install the latest MinGW and MSYS tools
  2. Either permanently modify the PATH variable, or temporarily modify it with set PATH=%PATH%;C:\MinGW\bin;C:\MinGW\msys\1.0\bin
  3. cd \tutorial\fgw_headers
  4. rmdir /s /q Release
  5. mkdir Release
  6. bash
  7. make clean
  8. make
  9. cp Release/libfgwz.a .
  10. Configure IDE as appropriate


References