The best way to create new projects is by using the Visual C++ application wizards. Visual C++ application wizards work with the application frameworks and libraries to create starter programs for you.
To create ANSI C programs by using the Visual C++ application wizards in the Visual Studio .NET or Visual Studio 2005 IDE, follow these steps:
To create ANSI C programs by using the Visual C++ application wizards in the Visual Studio .NET or Visual Studio 2005 IDE, follow these steps:
- Start Microsoft Visual Studio .NET or Microsoft Visual Studio 2005.
- On the File menu, point to New, and then click Project.
- Under Project Types, click Visual C++ Projects.
Note In Visual Studio 2005, click Visual C++ underProject Types. - Under Templates, click Win32 Project.
- In the Name text box, type FirstApplication.
- In the Location text box, type C:\Test, and then click OK.
The Win32 Application Wizard - FirstApplication dialog box appears. - In the Win32 Application Wizard dialog box, clickApplication Settings in the left pane.
- Under Application Type, click to select any of the following options:
- Console application: Creates a simple console application. The application files include a .cpp file that contains an emptymain function.
- Windows application: Creates a simple Microsoft Windows-based application. The application files include aProjectName.cpp file that contains a _tWinMain function. You can use this type of application to perform graphical user interface (GUI) based programming.
- DLL: Creates a 32-bit Windows-based DLL application project.
- Static library: Creates a 32-bit Windows-based DLL application project.
- Under Additional options, click to select theEmpty project check box.
Note To create a simple "Hello World!" program, do not select this check box. Instead, let the wizard generate the code for you. - Click Finish.
- In Solution Explorer, right-click the Source Files folder, point toAdd, and then click Add New Item.
- In Add New Item - FirstApplication dialog box, clickC++ File (.cpp) under Templates.
- In the Name text box, type Test.c, and then click Open.
- In the Test.c code window, paste the following code:
#include <stdio.h> int main() { printf("Hello World\n"); return 0; }
- On the Build menu, click Build Solution.
- Press CTRL+F5 to run the application. You receive the following message in a Command Prompt window: