I remember having problems like that when some used units were not part of the project that was being built. So make sure all your unit source files are included in the dproj-file using add to project.