Join Bill Weinman for an in-depth discussion in this video Exercise files, part of C++: Move Semantics.
- The exercise files for this course are included with your basic lynda.com membership. If you're a lynda.com member then you have access to the exercise files used for this title. Copy the ExerciseFiles folder to a location where you can find it on your system. I've copied it to the desktop on this system, wherever you put it, just make sure you can find it. All of the exercise files for this course are in this folder. As you use each of these files, I suggest that you make a working copy so that you can easily revert back to the original if you need to.
This course requires a development environment with the C++11 compliant compiler. I'm using a Mac with Xcode and Apple's Xlint LLVM-based compiler for the demonstrations in this course. You may just as easily use Windows or any other operating system with a C++11 compliant compiler. Please see my course C++ Essential Training here on the lynda.com Online Training Library for instructions on how to use these exercise files with either Xcode or Microsoft Visual Studio.
If we scroll down here, you see these movies here, Using Xcode with the exercises, Using Microsoft Visual Studio with the exercises, from C++ Essential Training will tell you what you need to be able to use the exercise files in this course. The code in this course requires a standards compliant C++ runtime library. Unfortunately, if you're using Microsoft Visual C++, there are a few standard functions missing from the library. I have provided suitable replacements for the missing functions here in the exercise files.
To use these functions, I'm gonna come up here to my working project and I'm going to add existing item and here I am in the ExerciseFiles. These two files here, and I'm holding down ctrl to select both of them, you can just go ahead and add those to your library and leave them there. And they'll be used when they're needed. Then when I need to add one of the exercise files, for example, here I'm gonna make a working copy of this rational-04 and I'm gonna add the copy, and there it is.
Then I just press F7 and it will build and I can go ahead and switch to my console and run it, and you can see that it works perfectly. So that code, here it says "ifdef", this is an ifdef that checks to see that we're using a Microsoft compiler. It'll go ahead and include this posix.h which has the missing functions and it will also compile this bw_msposix.cpp which has the code for these missing functions and it will all just work perfectly.
Then when you're done with a given exercise file, you can just select that file and delete it from your project and then add another one, like for example, here I'm gonna go ahead and delete that working copy. Just open, say this hello.cpp, I'll make a working copy of that and select that here and press F7 to build, and go ahead and run that in my console and it says "Hello, World!" So you can just leave these bw_msposix in here for the entire duration of your doing the exercise files in this course and it will totally solve the problem.
The exercise files are here to make your learning experience easier and more powerful so take your time, experiment a lot and happy learning.