Hints and Tips
WARNING: All definitions are ONLY relative to Visual Studio! It can work elsewhere but not all can.
Compiler: A program that converts your high level language (C++) into a running program... and many other tasks that you don't need to know about.
Compile: The process of converting a high level language (C++) into assembly with relative memory reference
WHAT IT MEANS: It's the process that checks for syntax errors in your code.
Link: Turning relative memory references in the assembly to absolute references. It is also implied that the program will be turned into an executable (a running program) at that time.
WHAT IT MEANS: It turns your compiled code into a running program.
Build: The process of both compiling and linking. This is done so that you can have a program ready to run with one command. This can also be done with multiple projects (not necessary for you to know).
Syntax Errors: An error that is caused by bad grammar or typos and such in a code. (i.e. you forgot a semicolon at the end of a statement)
Link Error: This usually means that you told C++ that you have something when it really doesn't exist. A good example is if you created the wrong type of project and the compiler is trying to look for a WinMain function instead of a main function.
Runtime Error: Anything bad that happens when you run your program after the build. Common examples are really odd looking outputs, a possessed program (keep doing stuff when you don't know what's going on), bad calculation, crashes, and the blue screen of death. These are sometimes called Semantic Errors, semantic means meaning. The common cause of these are bad calculations, misusage of pointers, and bad conditions that makes no sense. Another common problem is running out of resource or lack of permission on a public computer.
Debug: The process of making a bad code work. This can be fixing syntax or semantic errors.
Shortcuts and Tricks:
Function A does not take X number of parameters.
- You gave a function too many arguments. For example: pow(a,b,c)... which doesn't work because it's the power function. Another good example is cout << "hi" , "you"; That will not work because of the comma. C++ will treat that comma as some sort of argument separater.
- You declared the function one way in the prototypes and then decided to add a parameter somewhere down the road. What I mean is you somehow decided to add a parameter to the function at one point and forgot to update the prototype to reflect that change down the road. When you decide to call that function and use the changed parameter list it doesn't match the prototype. This will also lead to other bigger problems like link errors down the road if this doesn't get resolved.
Creating a project in Visual Studio (or Visual C++):
Visual Studio is the name of a set of compilers created by the Microsoft Corporation. The one that we are using is Visual C++. Depending on the year of your copy you may have Visual C++ v.6, Visual Studio .NET, or Visual Studio .NET 2003, in chronological order. I will not include instructions for Visual C++ since it is quite obsolete in my opinion. If you do want to use it, however, contact me and I'll try to help.
There are many ways to start a project in Visual Studio (it's the same in both .NET and .NET 2003) but I will only describe one for simplicity.
This is the box that should pop up after step 1:
The bad circling job with the numbers next to it refers to the steps that they illustrate.
This is what you should see after step 6:
Once again the really bad circling job with the numbers next to it illustrates the steps they indicate.
This is what you should see after step 11
Once again the really bad circling job with the numbers next to it represents the step it illustrates.