编译 QTermWidget [英] Compiling QTermWidget
问题描述
我尝试编译这个自定义 QT 小部件以提供一个可以嵌入到我的应用程序中的终端. 我已经编译/安装了我需要的程序构建工具在 Cmake 完成之前,但 make 步骤抛出了谷歌没有太大帮助的错误:
I've tried to compile this custom QT widget to provide a terminal that I can embed into my application. I've compiled/installed the build tools for the program that I needed before Cmake would complete, but the make step is throwing errors that google hasn't been too helpful on:
[ 50%] Building CXX object CMakeFiles/qtermwidget5.dir/lib/kpty.cpp.o
/Users/a7c/qtermwidget/qtermwidget-master/lib/kpty.cpp:506:26: error: no member named 'ut_name' in 'utmpx'
strncpy(l_struct.ut_name, user, sizeof(l_struct.ut_name));
~~~~~~~~ ^
/Users/a7c/qtermwidget/qtermwidget-master/lib/kpty.cpp:506:57: error: no member named 'ut_name' in 'utmpx'
strncpy(l_struct.ut_name, user, sizeof(l_struct.ut_name));
~~~~~~~~ ^
/Users/a7c/qtermwidget/qtermwidget-master/lib/kpty.cpp:617:20: error: no member named 'ut_name' in 'utmpx'
memset(ut->ut_name, 0, sizeof(*ut->ut_name));
~~ ^
/Users/a7c/qtermwidget/qtermwidget-master/lib/kpty.cpp:617:44: error: no member named 'ut_name' in 'utmpx'
memset(ut->ut_name, 0, sizeof(*ut->ut_name));
~~ ^
4 errors generated.
make[2]: *** [CMakeFiles/qtermwidget5.dir/lib/kpty.cpp.o] Error 1
make[1]: *** [CMakeFiles/qtermwidget5.dir/all] Error 2
make: *** [all] Error 2
有没有人有解决这个问题的方法?
Does anyone have a solution to this problem?
作为扩展,如何有效地包含自定义小部件以便在 QT Creator 中可用?
And as an extension, how exactly does one effectively include a custom widget as to be usable in QT Creator?
推荐答案
http://pubs.opengroup.org/onlinepubs/7908799/xsh/utmpx.h.html
看起来它在 utmpx.h 的股票版本中不包含 ut_name
.
It looks like it doesn't include ut_name
in the stock version of utmpx.h.
如果你看看这个版本:
https://code.woboq.org/kde/include/bits/utmp.h.html
他们在那里有一个向后兼容性黑客":
They have a "backwards compatibility hack" in there:
87 /* Backwards compatibility hacks. */
88 #define ut_name ut_user
您可能想要升级包含该标头的库.或者只是在您的代码中插入 #define
.作为一个优秀的 github 公民,如果它有效,你应该做一个拉取请求和/或提交一个关于它的问题,这样下一个使用该库的人就不会遇到同样的问题.
You may want to upgrade that library that includes that header. Or just insert that #define
in your code. And as a good github citizen, if it works, you should do a pull request and/or submit an issue about it so that the next person using that library doesn't run into the same issue.
希望有所帮助.
这篇关于编译 QTermWidget的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!