Compiling and Running a Program.
- In the end the program needs to run on a linux machine.
- This is a requirement of the class.
- You need to learn to do this.
- To do this I will need an account on a linux server
- I would like you to use a machine called cslab103.cs.edinboro.edu
- But you could also use cslab100.cs.edinboro.edu or cslab101.cs.edinboro.edu
- These accounts are not yet set up.
- I will provide details when they are.
- The first step is to transfer the program from your laptop to the server
- I use winscp.
- This is a file transfer program.
- It performs many other tasks as well.
- Transfer the file via winscp.
- The next step is to compile your program.
- Your program is written in a High Level programming language.
- C++
- But others as well.
- These are easier for humans to understand.
- But can not be run or executed by a computer.
- They need to be translated into the machine language for the target computer.
- Machine language
- This is the language the computer can execute.
- It is almost certainly a series of 0 or 1
- It is NOT easy for a human to understand.
- But it is easy for the computer.
- A compiler is a program that translates from a high level language to a machine language.
- The compiler we will use is called g++
- To run the compiler, you will need to log into the server.
- To do this we will use another program putty
- This allows us to log into a remote computer and work on it.
- Again, you will need credentials we do not yet have.
- For now, to compile a program called
game.cpp
- Two things could happen when you try to compile
- Most likely, a syntax error will occur
- This means you didn't use the proper syntax (or grammar) for c++
- The compiler will attempt to describe the error.
- you need to fix it and try again.
- (Edit, transfer, compile)
- Your program will compile
- This will produce an executable file or executable program that can be run or executed on the computer.
- In this case it will be called game
- To run it type
./game
- We have seen the complete edit-compile-execute cycle
- We will continue to develop the program using these tools.