无法加载此类文件 - Qt4

时间:2012-12-25 12:44:13

标签: ruby qt4

我想开始使用Ruby + Qt4。我已经下载了

$yum list qt* | less

Installed Packages
QtDMM.x86_64                         0.8.12-4.fc17          @fedora             
qt.i686                              1:4.8.4-1.fc17         @updates            
qt.x86_64                            1:4.8.4-1.fc17         @updates            
qt-assistant.x86_64                  1:4.8.4-1.fc17         @updates            
qt-creator.x86_64                    2.4.1-2.fc17           @fedora             
qt-demos.x86_64                      1:4.8.4-1.fc17         @updates            
qt-devel.x86_64                      1:4.8.4-1.fc17         @updates            
qt-doc.noarch                        1:4.8.4-1.fc17         @updates            
qt-examples.x86_64                   1:4.8.4-1.fc17         @updates            
qt-mobility.i686                     1.2.0-10.20110922.fc17 @fedora             
qt-mobility.x86_64                   1.2.0-10.20110922.fc17 @fedora             
qt-settings.noarch                   4.8-22.fc17            @updates            
qt-x11.i686                          1:4.8.4-1.fc17         @updates            
qt-x11.x86_64                        1:4.8.4-1.fc17         @updates            
qt3.x86_64                           3.3.8b-41.fc17         @fedora             
qt4-theme-quarticurve.x86_64         0.0-0.17.beta8.fc17    @fedora             
qtscriptbindings.x86_64              0.2.0-3.fc17           @updates            
qtsoap.x86_64                        2.7-3.fc17             @fedora             
qtwebkit.i686                        2.2.2-1.fc17           @updates            
qtwebkit.x86_64                      2.2.2-1.fc17           @updates            
qtwebkit-devel.x86_64                2.2.2-1.fc17           @updates 

然后我创建了新的qt项目并将其转换为ruby代码

$rbuic4 -x example.ui -o example.rb

然后我尝试编译example.rb $ruby example.rb 并出现以下错误:

/home/n/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- Qt4 (LoadError)
    from /home/n/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from example.rb:10:in `<main>'

我该如何解决这个问题?

2 个答案:

答案 0 :(得分:1)

您要找的包是ruby-qt$yum list qt* | less无法找到ruby-qt。无论如何,所有ruby-qt二进制包都已过时。像卡尔建议的那样做sudo gem install qtbindings。它将从维护的ruby-qt源代码库进行编译。 qtbindings主页位于https://github.com/ryanmelt/qtbindings/

答案 1 :(得分:0)

尝试gem install qtbindings

并在example.rb require 'Qt'