Visual C++
Visual C++
1.
Steps: 1) Start Visual C++ from the Start menu 2) Select New from the File menu. 3) Click the Projects tab. 4) Click on Win 32 console application 5) Type <filename> into the project name box (no extension). 6) Set the location box to Z:\ (the place you want to save your project to) 7) Click OK. 8) Select An empty project. 9) Click Finish. 10) Click OK. 11) Select the File menu and the New option. 12) Click the Files tab. 13) Click on C++ Source File. 14) Check the add to current project box. 15) Type the same <filename> as you gave to the project into the file name box. NOTE: If you make a mistake before you try again you must use explorer to find and delete the already created project. If you try to create a project that already exists you will get an error message.
2. Steps:
1) Type in the A Simple Program example from class. 2) Select Compile <filename.cpp> from the Build menu. If it worked correctly at the bottom of the window you should see the following: -------------------------------------------------------------------------------------------------Compiling... test.cpp test.obj - 0 error(s), 0 warning(s) 3) Next choose Build <filename.exe> from the Build menu. If it worked correctly at the bottom of the window you should see the following: Linking... test3.exe - 0 error(s), 0 warning(s) 4) Now choose Execute <filename.exe> from the Build menu or click on the exclamation point button in the toolbar. If it worked a command window should pop up and inside it should say: --------------------------------------------------------------------------------------------------Hello World. Press any key to continue. --------------------------------------------------------------------------------------------------5) Congratulations! You successful wrote, compiled, and executed your first C++ program. You can press any key. You can execute the same program again and again by repeating step 4).
NOTE: If you ran into problems around step 2 or 3 check your code. Make sure you didnt type something incorrectly. If it still doesnt work try starting over from scratch with a new project. I.e. follow the note at the end of Creating a new project. If you created the project incorrectly that might be the problem.
3. Steps:
Basic Debugging
1) Remove the semicolon from the end of cout << Hello World << endl; 2) Click on the save icon in the toolbar. 3) Compile the code as in step 2) above. NOTE: You can pull the white window which displays compiling information up with the mouse to see more of it. If you have the entire output displayed you should see something like this: --------------------Configuration: test3 - Win32 Debug-------------------Compiling... test.cpp Z:\ComputerClass\test\test.cpp(8) : error C2143: syntax error : missing ';' before 'return' Error executing cl.exe. test.obj - 1 error(s), 0 warning(s) When you forget a semi-colon in C++ its called a parse error and it will look like this. This is just one of hundreds of error messages you might see from the compiler. Notice that the last line tells you how many errors your program contains. Also notice that in the example above the error occurs at line 8. You can tell what line your cursor is on by looking at the bottom right-hand corner of the Visual C++ window. 4) Fix your error and try to recompile. 5) Dont be afraid to explore abit more.