问题
I have the following error when i try to make "bundle install" in my rails projects
C:/Ruby22/bin/ruby.exe -r ./siteconf20150427-5772-lng4pk.rb extconf.rb
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
generating byebug-i386-mingw32.def
compiling breakpoint.c
cc1.exe: warnings being treated as errors
In file included from c:/Ruby22/include/ruby-2.2.0/ruby/defines.h:163:0,
from c:/Ruby22/include/ruby-2.2.0/ruby/ruby.h:29,
from c:/Ruby22/include/ruby-2.2.0/ruby.h:33,
from ./byebug.h:4,
from breakpoint.c:1:
c:/Ruby22/include/ruby-2.2.0/ruby/win32.h:319:44: error: 'struct timespec' declared inside parameter list
c:/Ruby22/include/ruby-2.2.0/ruby/win32.h:319:44: error: its scope is only this definition or declaration, which is probably not what you want
c:/Ruby22/include/ruby-2.2.0/ruby/win32.h:320:43: error: 'struct timespec' declared inside parameter list
make: *** [breakpoint.o] Error 1
make failed, exit code 2
i'm on windows 7, after research a lot, i find that i have to unset the option of take warnings as errors. Anyone knows where i can unset such option (in the makefile isn't possible because the makefile is a generated file)
回答1:
This may not be what you want to hear. But I had this error a lot when I was developing RoR applications out of windows. I also had a plethora of other issues that have nothing to do with rails, and more to do with how Ruby interacts with the Windows OS. Ruby is very "Linuxy" in it's nature. Because of this, I would recommend using a virtual machine running linux ubuntu when developing using Ruby and Rails.
There is a great linux virtual machine called "Vagrant". It has been wonderful to use Ruby in. They have documentation on how to get up and running with Ruby found here:
https://www.vagrantup.com/
I hope this helps. I know switching to the Vagrant virtual machine helped me solve a lot of these futile problems that had nothing to do with writing the actual code.
来源:https://stackoverflow.com/questions/29901627/warnings-being-treated-as-errors-in-rails