You lack prototypes for various functions, namely OpenLibrary, CloseLibrary, and exit.
By default C compiler defaults to something like "int foo(...)", and obviously you can't assign integer to pointer with a cast.
Add
#include <stdlib.h>
#include <proto/exec.h>
stdlib.h for exit(), which btw needs an argument (return value).
proto/exec.h for OpenLibrary and CloseLibrary.