Creating a Console Application (2008)
Creating a Console Application (2008)
Assuming that you have already installed the IDE and opened it, you can run through the steps in this lesson to create your first program.
- In the menubar, left-click 'File,' mouse over 'New,' and left-click 'Project.' This will pop up a dialog box.
- Left-click 'Win32' in the 'Project Type' box. Then left-click 'Win32 Console Application' in the 'Templates' box. Finally, left-click the text box next to 'Name' and replace the text there with 'ConsoleLesson1' and click the 'OK' button.
- This will bring the application wizard. Left-click the 'Next' button to go to 'Application Settings.' Check the box next to 'Empty project' under 'Additional options:' by left-clicking it. Then complete the wizard by left-clicking the 'Next' button.
- Now, we have an empty project. To put a code file in the project, left-click 'Project' and then left-click 'Add New Item' in the menubar.
- This will bring up the 'Add New Item' dialog box. Now, left-click 'Visual C++' in the 'Categories' box and then left-click 'C++ File (.cpp)' in the 'Templates' box. Finally, left-click the text box next to 'Name' and replace the text there with 'main.cpp' and click the 'Add' button.
- Enter the 'Hello World' code shown here into the 'main.cpp' tabbed pane.
- In the menubar, left-click 'Debug' and 'Start Without Debugging' to build and execute the program.
- You might see a dialog box stating that 'This project is out of date' and asking if you: 'Would like to build it?' You can click the 'Yes' button, but I recommend also checking the box next to 'Do not show this dialog again' to stop this from popping up every time you run.
- Now you should see the console window displaying the message 'Hello World!'
#include <iostream>
int main() {
std::cout << "Hello World!" << std::endl;
return 0;
}
