I've fixed problems with some old compilers by dropping in a conversion to a "void pointer", such as (void *), before you cast to the final pointer type.
There are advantages and disadvantages of void pointers, so be careful to not abuse the use of them.