Don't ask for a solution if you don't explicitly explain the problem. If you are getting compilation errors, then show them here; if you are getting runtime errors, then explain them here. Personally, I don't check the code to try to find a bug without knowing more or less the situation.
In short: We don't like guessing what the problem is. Say what the problem is. Help us help you.
Both programs should compile fine (except that main should be int (second piece) , not short and that main should never be called (first piece) ).
The problem must be with how you compile this. These are two separate projects.