|
|
TRY IT OUT Creating an Empty Console Project The previous project contained a certain amount of excess baggage that you don’t need when working with simple C++ language examples. The precompiled headers option chosen by default resulted in the stdafx.h fi le being created in the project. This is a mechanism for making the compilation process more effi cient when there are a lot of fi les in a program, but it won’t be necessary for most of our examples. In these instances, you start with an empty project to which you can add your own source fi les. You can see how this works by creating a new project in a new solution for a Win32 console program with the name Ex1_02. After you have entered the project name and clicked OK, click Application Settings on the left side of the dialog box that follows. You can then select Empty project from the additional options. When you click Finish, the project is created as before, but this time without any source fi les. By default, the project options will be set to use Unicode libraries. This makes use of a non-standard name for the main function in the program. In order to use standard native C++ in your console programs, you need to switch off the use of Unicode libraries. To do this, select the Project ➪ Properties menu item, or press Alt+F7, to display the Property Pages dialog for the project. Select the All Confi gurations option from the Confi guration: drop-down list at the top. Select the General option under Confi guration Properties in the left pane and select the Character Set property in the right pane. You will then be able to set the value of this property to Not Set from the drop-down list to the right of the property name, as shown in Figure 1-10. Click OK to close the dialog. You should do this for all the C++ console program examples in the book. If you forget to do so, they won’t build. You will be using Unicode libraries in the Windows examples, though. |