为什么安装Ruby on Rails会产生错误“数组的大小ruby_check_sizeof_voidp是否定的”?

在安装Ruby on Rails(通过gem install rails )时,您可能会收到以下错误消息:

 c:/Ruby193/include/ruby-1.9.1/ruby/ruby.h:109:14: error: size of array 'ruby_check_sizeof_voidp' is negative 

也会有这样的警告:

 c:/Ruby193/include/ruby-1.9.1/ruby/ruby.h:1333:12: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] 

和一个额外的错误

 c:/Ruby193/include/ruby-1.9.1/ruby/missing.h:41:8: error: redefinition of 'struct timespec' 

为什么会发生这种情况,如何成功安装Rails?

当你为你的Ruby版本安装了错误的DevKit版本,例如,如果你安装了DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe到Ruby版本1.9.3,就会发生这种情况。

要解决这个问题,请重新安装Ruby,并为您的Ruby版本安装正确的DevKit,如标题为“哪个开发工具包? http://rubyinstaller.org/downloads