You call myfunction( ) before the compiler has seen a prototype or definition of myfunction( ). Either move your square( ) and myfunction( ) code above the mexFunction( ) code, or put prototypes at the top of your code. E.g., put these lines at the front:
float square ( float x );
int myfunction(int argc, char *argv);
When you call a function before the compiler knows about it, the compiler assumes the function returns an int and that the argument types are exactly as listed. I.e., you get no argument type promotion and the function return type might be wrong. This can lead to crashes, or worse a wrong result without you knowing anything went wrong. C lets you get away with this and will compile the code anyway ... C++ will not let you get away with this and will not compile the code.
Bottom line: Always make sure you have function prototypes or definitions appearing in the code before they are used.
Side Note: On earlier versions of MATLAB, the mxArrayToString allocations were not put on the gargabe collection list, so your current code will leak memory on those versions if you run into an error condition.