How to use Microsoft's Visual Studio .NET to create a C++ Win32 Console Application
To create a new project and add a source file
-
Create a new project:
On the File menu, point to New, then click Project….
-
From the Visual C++ project types, click Win32, then click Win32 Console Application.
-
Enter a project name.
By default, the solution that contains the project has the same name as the new project, though you can enter a different name. You can enter a different location for the project if you wish.
Click OK to create the new project.
-
In the Win32 Application Wizard, select Empty Project and click Finish.
-
If Solution Explorer is not visible, click Solution Explorer on the View menu.
-
Add a new source file to the project:
-
Right-click on the Source Files folder in Solution Explorer and point to Add and click New Item.
-
Click C++ File (.cpp) from the Code node, enter a file name, and then click Add.
The .cpp file appears in the Source Files folder in Solution Explorer and a tabbed window appears where you type in the code.
-
Click in the newly created tab in Visual Studio and type in a valid C++ program that uses the Standard C++ Library, or copy and paste code you created before.
(For example, you can use the set::find (STL Samples) sample program in the Standard Template Library Samples topics in the help. See How to: Compile a Code Example from the Help Topics for information on copying a sample program to the Clipboard.)
(If you use the sample program for this procedure, notice the using namespace std; directive. This allows the program to use cout and endl without requiring fully qualified names (std::cout and std::endl). )
- On the Build menu, click Build Solution.
The Output window displays information about the compilation progress, such as the location of the build log and a message indicating that the build succeeded
-
On the Debug menu, click Start without Debugging.
(If you used the sample program, a command window is displayed that shows whether certain integers are found in the set.)
|