That error literally means that the X Window System display can't be
opened. But it didn't report a name. So I assume that the DISPLAY
environment variable is not set. And if that is not set then I assume
it means that you do not have a graphical display available at that
moment in time.
Try opening another X program. Try opening "xclock".
$ xclock
That is a very simple program. If that works then it proves that you
can open new windows. If it fails then it proves that there isn't a
problem with ddd but simply with your environment. Fix that and ddd
will then work fine.
These days most people log into a system using a graphical login
manager and since you are asking this question I assume that you did
too. The display environment is set up automatically at that time.
If it isn't then very little will work correctly. Start debugging
your problem there.
Bob