- Select Win32 under Visual C++ in Installed Templates from the left, and select Win32 Console Application from the middle, Enter Name (HelloWin32Console) and click OK.
- Win32 Application Wizard will list current project settings, click Finish.
- A dummy project of Win32 console application will be generated. Notice that a function of _tmain(int argc, _TCHAR* argv[]) is generated, it have the same function as main() in normal C++ program.
- Modify HelloWin32Console.cpp as listed below:
// HelloWin32Console.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <iostream> int _tmain(int argc, _TCHAR* argv[]) { std::cout << "Hello Win32 Console Application!" << std::endl; std::cout << "Press ENTER key to exit." << std::endl; getchar(); return 0; }
- Click File -> Save All (or Ctrl+Shift+S) to save all the works.
- Click Debug -> Build Solution (or F7) to build the application.
- Click Debug -> Start Debugging (or F5) to run it.
No comments:
Post a Comment