In this paper an error function for optimum dimensional synthesis of mechanisms using genetic algorithms is presented. This function is general for its use with any mechanism with R and P joints. This minimization function is established as the quadratic addition of the minimum linear or angular distance to the synthesis positions which can be achieved by the mechanism. To get this distance, a non-linear function must be iteratively solved, leading to a high computational cost function. In order to reduce the computational cost, variable complexity functions techniques can be applied. Solutions obtained with this genetic algorithm are a good starting point for further numerical optimization methods.