找回密码
 新建账号

error: ‘class wxFont’ has no member named ‘GetBaseFont’

[复制链接]
php 发表于 2024/4/28 16:13 | 显示全部楼层 |阅读模式
Ubuntu 编译 FileZilla Server 时报错,错误信息是 ‘class wxFont’ has no member named ‘GetBaseFont’。
  1. mounttableeditor.cpp: In member function ‘bool MountTableEditor::Create(wxWindow*, wxWindowID, const wxPoint&, const wxSize&, long int, const wxString&)’:
  2. mounttableeditor.cpp:158:41: error: ‘class wxFont’ has no member named ‘GetBaseFont’
  3.   158 |                 h->SetFont(h->GetFont().GetBaseFont());
  4.       |                                         ^~~~~~~~~~~
复制代码
导致编译失败
  1. ...
  2. mounttableeditor.cpp: In member function ‘bool MountTableEditor::Create(wxWindow*, wxWindowID, const wxPoint&, const wxSize&, long int, const wxString&)’:
  3. mounttableeditor.cpp:158:41: error: ‘class wxFont’ has no member named ‘GetBaseFont’
  4.   158 |                 h->SetFont(h->GetFont().GetBaseFont());
  5.       |                                         ^~~~~~~~~~~
  6. make[3]: *** [Makefile:1080: filezilla_server_gui-mounttableeditor.o] Error 1
  7. make[3]: Leaving directory '/home/wuxiancheng/filezilla-server-1.8.2/src/gui'
  8. make[2]: *** [Makefile:426: all-recursive] Error 1
  9. make[2]: Leaving directory '/home/wuxiancheng/filezilla-server-1.8.2/src'
  10. make[1]: *** [Makefile:365: all] Error 2
  11. make[1]: Leaving directory '/home/wuxiancheng/filezilla-server-1.8.2/src'
  12. make: *** [Makefile:459: all-recursive] Error 1
复制代码
首先,这个错误是 wxWidgets 的 wxFont::GetBaseFont() 触发的,其次,wxFont::GetBaseFont() 是在 wxWidgets 3.1.0 中引入的,如果 wxWidgets 版本低于 3.1.0,wxFont 没有 GetBaseFont(),会触发 ‘class wxFont’ has no member named ‘GetBaseFont’ 这个错误。Filezilla Server 的 configure 脚本在检查依赖时只要满足 wxWidgets 3.0.4+ 就可以通过检测,但编译中途会出错。
  1. wxFont wxFont::GetBaseFont() const
  2. Returns a font with the same face/size as the given one but with normal weight and style and not underlined nor stricken through.
  3. Since
  4. 3.1.0
复制代码
将 wxWidgets 升级到 3.1.0 或更高版本可以解决这个问题。
Ubuntu 22.04 上 wxWidgets (libwxgtk3.0-gtk3-dev)的版本号是
  1. 3.0.5.1+dfsg-4
复制代码
Ubuntu 22.04 不提供更高版本的 wxWidgets,可以到 wxWidgets 官方下载载源码自行编译,编译安装高版本的 wxWidgets 以后再次编译 FileZilla Server 就不会报 ‘class wxFont’ has no member named ‘GetBaseFont’ 这个错误了。

相关链接 wxWidgets  wxFont::GetBaseFont() FileZilla Server

手机版|轻松E站

GMT+8, 2024/11/21 14:20

快速回复 返回顶部 返回列表