I got this error when i tried to install various ruby gems on system.
I am using the Fedoa 9 as OS. I tried a lot to fix this issue and googled lot but not found exactly solution.
later on realize some of latest software are not installed on OS that’s why i am getting these kind of error.
you need to install proper software on Fedora box.
# yum install ruby ruby-libs ruby-mode ruby-rdoc ruby-irb ruby-ri ruby-docs
#yum install gcc-c++
this is the solution.