diff -uNr a/ofstd/include/dcmtk/ofstd/ofpwd.h b/ofstd/include/dcmtk/ofstd/ofpwd.h
--- a/ofstd/include/dcmtk/ofstd/ofpwd.h
+++ b/ofstd/include/dcmtk/ofstd/ofpwd.h
@@ -31,6 +31,9 @@
 #ifdef HAVE_PWD_H
 #include <pwd.h>
 #endif
+#ifndef HAVE_PASSWD_GECOS
+#undef pw_gecos
+#endif
 END_EXTERN_C
 
 #ifdef HAVE_WINDOWS_H
