gpt4 book ai didi

qt - 如何从 matlab 调用 Qtproject?

转载 作者:行者123 更新时间:2023-12-04 18:12:28 29 4
gpt4 key购买 nike

我在 matlab 中有一个函数,它编写了我在我的 qt 项目中使用的 file.txt。

所以,

当我得到一个使用 unix() 运行的 qt 编译可执行文件时,我有一个 Matlab 文件,但是我收到了一个错误。

编码:

unix('/home/matt/Desktop/PlaneVolumeFinal/PlaneVolumeGui');

错误:
/home/matt/Desktop/PlaneVolumeFinal/PlaneVolumeGui: symbol lookup error: /home/matt/Desktop
/PlaneVolumeFinal/PlaneVolumeGui: undefined symbol: _ZN9QListData7detach3Ev

最佳答案

正如@grungetta 所指出的,这个问题可能与 MATLAB 本地库路径没有看到您的 Qt 库有关,例如 libQtMultimedia.so , 通常应该在任何 shell session 中通过 LD_LIBRARY_PATH 可见的路径中变种。

解决此问题的一种方法是显式设置 LD_LIBRARY_PATH 的值。从 MATLAB 运行 session 中(如果需要继续,则重新存储它)。您的 MATLAB 脚本的示例命令集可能是:

%*** save local (MATLAB's) LIBRARY PATH
libPathLocal = getenv('LD_LIBRARY_PATH');

%*** set your global LIBRARY PATH
PATH_LD_LIBRARY = '/usr/lib/' % or any string containing library files required
setenv('LD_LIBRARY_PATH', PATH_LD_LIBRARY);

%*** call binary through 'unix' or 'system'
system('/home/matt/Desktop/PlaneVolumeFinal/PlaneVolumeGui');

%*** restore session's MATLAB's library path
setenv('LD_LIBRARY_PATH', libPathLocal);

关于qt - 如何从 matlab 调用 Qtproject?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12350282/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com