Introduction Welcome Getting Started My First Program     Troubleshooting and Distributing Transforming Data Interactive Programs     Programming Exercises     Making Games
Documentation Declarations     Procedures     Variables Statements     Flow Control Expressions Libraries     Print     IO     Random     Game Engine
Tutorials Complete Tutorials     Introduction to Programming     Quick Start     Programming Exercises     Programming Games

TROBLESHOOTING AND DISTRIBUTING


Understand how to solve errors and share your creations with the world!





Fixing Errors

Hopefully, last time around things went smoothly when creating the program, but that will not always be the case. As the programs grow in complexity, it becomes harder and harder to get it right the first time, so programming becomes an iterative activity of coming up with a solution to a problem, implementing that solution, evaluating how well it solved the problem and heading to the next problem.
As you practice programming, you will develop those problem-solving skills more and more, as well as being able to break down a problem into smaller problems.

When it comes to implementing a solution you will often encounter a compilation error signaling that the text you type (or the nodes you connected) couldn't be transformed into valid machine code.
In these cases, it becomes an important skill to understand what instructions you are giving the computer and where it can fail.

For example, if you create a blank project in Vizzcode and compile the program, you will see the following error message:
[Compilation Error]

Empty code. You must type or add nodes to compile the program.
Not sure how to get started? Click here to start learning!

As you can see, apart from the threatening [Compilation Error] title, there is actually a very helpful message as well as a link you can click to go to a more complete explanation on the topic (in this case, an explanation on how to get started).
If you remember from last time, you should create a procedure and name it main to signify the entry point of the program.

The compiler expects the text code (and the nodes) to follow a certain set of rules and it will display an error when it's unable to generate valid code.
For instance, if you try importing a library with an invalid name, an error will occur:
[Compilation Error]

This library does not exist: 'Invalid Name'. Happened in this node.

Not only it explains the error and links you to a more complete explanation (containing all the possible libraries in this case), it also points you to the exact place the error occurred, be it a visual node or text.

A common error is forgetting to add "double quotes" in literal strings. We will talk a lot about it when the time comes, but if you forget the ( " ) when calling print, for instance, you will encounter the following error:
[Compilation Error]

Undeclared identifier 'Hello' in this node.

Even though it points you to the problematic node like last time, the error is a bit less descriptive if you are not familiar with identifiers.

Because of cases like this, it's recommended that you constantly compile the program as you add more nodes or more text code, so you know exactly what you changed since the last successful compilation. Avoid throwing a bunch of code at once and only then compiling, because it will make it harder to find the possible cause of the error.
The compiler is your friend and will try its best to help you build your programs, you can count on it! :)




Sharing your Program

One great aspect of creating a cool computer program is sharing it with friends or even selling it to the world.
In Vizzcode the programs you create are actual computer programs that can be shared, distributed, published, sold, whatever you like! And the users of your programs don't need to own Vizzcode or anything like that!

If you are on the Premium version of Vizzcode, when you compile a program, a .exe file is created in the project folder.
This is the file you can share for people to run your program!

If you see two executable files in the directory where you created the project, you can ignore the .exe file that ends with the underscore '_'.

The executable files generated by Vizzcode

Try double-clicking the .exe file to see your program executing. If you created a console program (a program that doesn't launch a window of its own, like a game) it will launch a console window, run the program and then close the window. These programs are meant to be run from inside a command prompt terminal. The other executable in the directory (the one that ends with the underscore '_') will stop the console window from closing. It serves as a way to see the results of the console program even when not running from inside a terminal window.

You can then send the .exe to people you want to show the program you created!
If your program references files from inside of it (like a game that displays images), you also have to send all the files the program references. It's common to zip all the necessary files (the executable and the dependent files) and share that .zip instead.

Cool? Cool.
Now I think you can start tackeling bigger programs... :)