Meson - 如何指定使用哪个 wxgtk 版本?

时间:2021-03-20 00:19:59

标签: wxwidgets meson-build

我正在使用 Arch Linux 并使用从 wxgtk3 安装的 pacman 开发一个项目,我还从 wxformbuilder 安装了 AUR,它引入了 {{ 1}} 作为依赖。当我尝试构建我的程序时,它构建得很好,但是当我尝试运行它时,它会抛出一个巨大的错误消息,

wxgtk2

这只是错误的一小部分..

但是如果我卸载 . . ./src/common/object.cpp(245): assert "classTable->Get(m_className) == NULL" failed in Register(): Class "wxTreebook" already in RTTI table - have you used IMPLEMENT_DYNAMIC_CLASS() multiple times or linked some object file twice)? ./src/common/object.cpp(245): assert "classTable->Get(m_className) == NULL" failed in Register(): Class "wxVListBox" already in RTTI table - have you used IMPLEMENT_DYNAMIC_CLASS() multiple times or linked some object file twice)? ./src/common/object.cpp(245): assert "classTable->Get(m_className) == NULL" failed in Register(): Class "wxVScrolledWindow" already in RTTI table - have you used IMPLEMENT_DYNAMIC_CLASS() multiple times or linked some object file twice)? ./src/common/object.cpp(245): assert "classTable->Get(m_className) == NULL" failed in Register(): Class "wxHScrolledWindow" already in RTTI table - have you used IMPLEMENT_DYNAMIC_CLASS() multiple times or linked some object file twice)? ./src/common/object.cpp(245): assert "classTable->Get(m_className) == NULL" failed in Register(): Class "wxHVScrolledWindow" already in RTTI table - have you used IMPLEMENT_DYNAMIC_CLASS() multiple times or linked some object file twice)? ./src/common/object.cpp(245): assert "classTable->Get(m_className) == NULL" failed in Register(): Class "wxXmlResourceHandler" already in RTTI table - have you used IMPLEMENT_DYNAMIC_CLASS() multiple times or linked some object file twice)? (SampleHive:26191): Gtk-ERROR **: 05:45:13.924: GTK+ 2.x symbols detected. Using GTK+ 2.x and GTK+ 3 in the same process is not supported zsh: trace trap ./SampleHive 并尝试再次运行我的程序,它运行良好。有没有办法在 wxgtk2 中指定始终使用 meson,这样我就不必一次又一次地卸载 wxgtk3,因为我需要在我的系统上安装 wxgtk2 .

编辑:

这是我的 wxformbuilder 文件,

meson.build

构建我运行的项目,

project('SampleHive', 'cpp',
  version : '0.1',
  license : 'GPL v3',
  default_options : ['warning_level=1',
                     'cpp_std=c++11'])

src = [

  'src/App.cpp',
  'src/MainFrame.cpp',
  'src/Browser.cpp',
  'src/SettingsDialog.cpp',
  'src/TagEditorDialog.cpp',
  'src/Database.cpp',
  'src/Serialize.cpp',
  'src/TreeItemDialog.cpp',
  'src/Tags.cpp',

  ]

wx = dependency('wxwidgets', modules : ['media', 'std'])
wxsvg = dependency('libwxsvg')
taglib = dependency('taglib')
sqlite3 = dependency('sqlite3')
yaml = dependency('yaml-cpp')

wx_inc = include_directories('/usr/include/wx-3.0')

executable('SampleHive',
           sources : src,
           dependencies : [wx, wxsvg, taglib, sqlite3, yaml],
           include_directories : wx_inc)

这里是存储库的链接 - SampleHive

3 个答案:

答案 0 :(得分:1)

您可以为您的依赖项指定版本:

some_dep = dependency('some_dep', version : '>=1.2.3')

在你的情况下,使用:

wx = dependency('wxwidgets', modules : ['media', 'std'], version: '>=3.0.0')

答案 1 :(得分:0)

@apporv,

要构建您的项目,请执行以下操作:

cd <my_project_dir>
g++ -o <my_project_binary_name> *.cpp `/path/to/wx-config/wx-config --cxxflags --libs`

然后就这样做:

./my_project_binary

非常简单明了。

确保在 wx-config 命令周围使用背包。

答案 2 :(得分:0)

刚刚检查过,wxformbuilder-git 中有一个 AUR 包,它拉取 wxgtk3 而不是 wxgtk2 作为依赖项,因此应该可以解决我的问题。

相关问题