diff --git a/source/Plugins/Process/Utility/RegisterContext_x86.h b/source/Plugins/Process/Utility/RegisterContext_x86.h
index df3e1e5..36d23c4 100644
--- a/source/Plugins/Process/Utility/RegisterContext_x86.h
+++ b/source/Plugins/Process/Utility/RegisterContext_x86.h
@@ -391,6 +391,13 @@ struct XMMReg
     uint8_t bytes[16];      // 128-bits for each XMM register
 };
 
+// In some cases, g++ will define 'i386' which will cause build errors as a struct
+// below have the same name.  We #undef it here to avoid the error. If someone need this
+// macro then it is better to use __i386__ which follows correct namespace convention.
+#ifdef i386
+#undef i386
+#endif
+
 // i387_fxsave_struct
 struct FXSAVE
 {
