1

我想开始使用 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>'

我怎么解决这个问题?

4

2 回答 2

1

您正在寻找的包裹是ruby-qt. $yum list qt* | less找不到ruby-qt。无论如何,所有 ruby​​-qt 二进制包都已过时。sudo gem install qtbindings按照卡尔的建议去做。它将从维护的 ruby​​-qt 源存储库编译。qtbindings 主页位于https://github.com/ryanmelt/qtbindings/

于 2016-01-10T09:46:43.243 回答
0

尝试gem install qtbindings

并在 example.rbrequire 'Qt'

于 2013-04-16T21:22:13.977 回答