Deborah R. Fowler
Resources for C++ - Introduction
Updated on May 17 2015Updated on Nov 1 2020
click here for syntax quick reference
click here for summary table of compiling
click here for
Raytracing in C++ (thank you to Zephyr Mann for sharing
his links to useful resources)
Why C++?
Examples and resources:
Textbook for VSFX Special Topics class being offered Winter 2013 is C++ Programming in easy steps, Fourth Edition by Mike McGrath (July 12, 2011), ISBN 978-1-84078-432-9. This textbook is an excellent crash course in C++ and is relatively concise.
Another recommended textbook used
in previous quarters for ITGM 315 class is Beginning
C++ Through Game Programming, Third Edition by
Michael Dawson, ISBN 1-4354-5742-0. (also available at Safari books
online through the SCAD library). This
textbook has an excellent summary
and Q & A section at the end of each chapter, and
is written more in a games flavor than visual effects but the
content is solid.
Also, if you would like to see an example RPG there is one here.
Excellent online tutorials exist at
A vast number of online code sites exist. Please look at the examples at the top of the course notes and in your textbook first as these are specifically geared toward the material covered in class.
If you are interested in other textbooks that delve more deeply into C++ there are a number on the market. The following may be of interest but are NOT required:
C++ Primer, Fourth Edition, by Stanley b. Lippman, Josee Lajoie, Barbara E. Moo. ISBN (0-201-72148-1).
Interesting reading about the development and FAQ on Bjarne Stroustrup's page (pronunciation file here).
IDE and Compilers:
C++ code is contained in a cpp file which will then be compiled. Various ways exist to create this code. On linux you can simply use a text editor (gedit at Monty) and compile using the gnu (g++) compiler or you can use Eclipse. On Windows you can also use the gnu compiler (c++), use Visual Studios IDE or use Eclipse IDE. Documentation is provided for all of these options below.For information on how to set up the gnu compiler on your own WINDOWS 10 machine: click here.
Eclipse can also be run on Windows: click here.
Also useful Geany, Sublime, Visual Studio Code
Eclipse on linux: Check if available in Monty. For instructions on how to include openGL compiling click here.
We now use Geany on linux CentOS in Monty.
Microsoft Visual Studio 2019: is the IDE (Integrated Development Environment) on Windows in Monty.
It is available in Windows on the machines in Montgomery Hall. It is very robust and a great IDE especially for beginning programmers.
Using C++ and Visual Studios at home?
Visual Studio Community 2019 is available. If it is already installed on your Window 10 image you will need to ensure you add C++ capability as it is not default.
Go to Tools -> Get Tools and Features - this opens the installer and you can select the C++ component and click Modify (tested on Window 10 home desktop 01/06/2018)
Zip tips if using VS:
To view zip files properly: copy the zip file to your Projects directory and right-click on the file. Select Extract all from the menu. You will now have a working project. This is the method you will use when copying files from the _MATERIALS folder.
To zip a directory: right-click on the folder and select 7-Zip then select "FolderName.zip" from the menu where Folder Name is what your particular folder is called. This is the method you will use to hand in your assignments if you are using VS.
Python versus C++
A bit of a silly debate - each language has its own purpose, strength and weaknesses - learn both! The standard Python interpreter is written in C.
Aside: A cool example, posted 2006, comparing C++ to Python can be found on a post to ubuntu forums:
In the C++ version, I reduced the includes to just <GL/freeglut.h> or <GL/glut.h> and include the code here and here. I was on Windows and tested this 01/06/2018 in Visual Studio Community 2017 (with nupengl.core instructions here)
I re-tested the python code 01/06/2018 and updated the instructions. Here are the first and second samples of the ubuntu forum thread. It took a bit of work the first time to set up as I always use official release versions - in this case that was a mistake and now it is easy if you follow the instructions here.
The debate goes on. Python is created in C. Python is interpreted and hence slower than compiled C++, however what about Cython? Here we muddy the water. For fun, read Sam Dutton's blog about Python is (not) better than C++
Python is a great language to learn as well and I would strongly advise learning both languages!
Also
included here for archive purposes - I no longer actively use
these, but there is still some useful info:
- Houdini HDK
- Maya
API - How to Get Started with Maya
Plug-ins by Ali Jafargholi. Excellent step by step
documentation on how to set up the build environment and
compile C++ code in Eclipse (linux).