ubuntu下安装qt(ubuntu下安装win10)

ubuntu下安装qt(ubuntu下安装win10)tbody tr td id artContent style max width 656px div style width 656px margin 0 padding 0 height 0 div lt td tr tbody

大家好,我是讯享网,很高兴认识大家。




讯享网

 <tbody> <tr> <td id="artContent" style="max-width: 656px;"> <div style="width: 656px; margin: 0; padding: 0; height: 0;"></div> <p>一、环境版本</p><p>以下分别对应虚拟机、操作系统和QT:17.0.0 build-&nbsp; <strong>VMware</strong>® Workstation 17 Pro、20.04.2-<strong>Ubuntu</strong>、<strong>qt</strong>-opensource-linux-x64-5.14.0.run。</p><p>二、安装步骤</p><p>2.1、输入命令赋予安装包权限</p><p></p><p></p><p>2.2、输入命令进行安装</p><p></p><p></p><p><strong>小技巧:</strong>断网安装,否则会进行不下去。默认会将qt安装在/opt下。</p><p>2.3、运行QCreator</p><p>在opt/Qt5.14.0/Tools/QtCreator/bin目录下找到可执行文件QtCreator,双击运行。<br></p><p>三、使用Qt</p><p>3.1、编译</p><p>在建立一个工程后,编译不能执行,kit中有提示,说明g++没有安装,故要手动安装。</p><p><strong>error1:the kit has a qt version,but no C++ compiler</strong></p><p>解决方案:sudo apt-get install g++</p><p><strong>error2:Could not start process &quot;make&quot; -f&nbsp;</strong></p><p>解决方案:apt install build-essential</p><p><strong>error3:cannot find -lGL</strong></p><p>解决方案:apt-get install libgl1-mesa-dev</p><p>以上3个问题解决后,可以正常编译并运行程序了。</p><p>3.2、打包Qt生成的程序</p><p>通过linuxdeployqt 来实现打包,该方法只需要在github下载 linuxdeployqt-continuous-x86_64.AppImage,然后使用linuxdeployqt(此处重命名了) xx即可实现Qt打包功能,打包后拷贝整个文件夹到未安装Qt的linux上即可。</p><p><strong>error4: &quot;/usr/bin/qmake -query&quot; exited with 1 : &quot;qmake: could not exec&quot;</strong>&nbsp;</p><p>解决方案:配置qmake路径,使用root权限:ln -s */Qt5.14.0/5.14.0/gcc_64/bin/qmake /usr/lib/x86_64-linux-gnu/qt5/bin/qmake 建立链接即可。(路径名称以实际版本为准)</p><p>3.3、如何在桌面上生成QtCreator图标</p><p>生成的桌面图标点击没有响应,不太清楚是什么原因,代码如下:</p><p></p><p></p><p>关闭虚拟机重启系统,功能正常了,内因不详。</p><p>用另一种链接来简化命令行的实现:</p><p></p><p></p><p>四、卸载Qt</p><p>/opt/Qt5.14.0/目录下找到MaintenanceTool,双击按照提示删除,为了删除干净,完成后执行下面命令:<br></p><p></p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<p></p><p>五、其他</p><p><strong>error:</strong>su root出现authentication failure提示</p><p>解决方案:</p><p></p><p></p><p><strong>error:</strong>VM虚拟机设置了共享目录但仍看不到</p><p>解决方案:这是因为还缺少一个挂载操作!</p><p></p><p></p><p>/mnt/hgfs/ 是挂载点,我们也可以修改为其它挂载点,-o allow_other 表示普通用户也能访问共享目录。<span style="color: rgb(77, 77, 77);font-variant-ligatures: no-common-ligatures;background-color: rgb(255, 255, 255);">如果每次重启之后想让系统自动挂载,需要修改</span>&nbsp;/etc/fstab, 在最后添加一行添加:</p><p></p><p></p><p><strong>error:</strong>重装VM tools后,进入ubuntu分辨率被改变。</p><p>解决方案:ctrl+Alt+T进入命令框,xrandr -s n来改,其中n为1~24整数。越小分辨率越高。</p><p><strong>error:</strong>Sorry,the application appLoader has stopped unexpectedly</p><p>解决方案:Ubuntu桌面版预装了Apport,它是一个错误收集系统,会收集软件崩溃、未处理异常和其他,包括程序bug,并为调试目的生成崩溃报告。当一个应用程序崩溃或者出现Bug时候,Apport就会通过弹窗警告用户并且询问用户是否提交崩溃报告。程序崩溃过一次,就会生成一个.crash文件,记录着崩溃信息,这些崩溃信息保存在目录: /var/crash/ ,<span style="color: rgb(77, 77, 77);background-color: rgb(255, 255, 255);">如果不是什么大问题,删除该文件就不会再报错误。</span>编辑/etc/default/apport,参数enabled=0可关闭这项功能,sudo apt-get purge apport直接移除apport。</p><p><strong>error:</strong>Low Disk Space on &quot;Filesystem root&quot;</p><p>解决方案:</p><p></p><p></p><p>查看磁盘占用率,有些已达到了100%,故要对磁盘进行扩容。</p><p></p><p></p><p>这是一款Ubuntu下的磁盘分区软件,用之前先要关闭当前的OS,在虚拟机上:虚拟机--&gt;设置--&gt;硬件--&gt;硬盘,对磁盘容量进行扩展,扩展后再启动OS,利用gparted对新扩展空间进行分区格式化。</p><p><strong>error:</strong>There is no application installed for &quot;shared library&quot;files</p><p>QT平台下按F5是可以执行程序,但到目录下双击会出现以上提示,应用程序中止。</p><p><strong>error:</strong>时钟不同步</p><p>虚拟机-&gt;设置-&gt;选项-&gt;VMTools&nbsp;开启时间同步。如果当时同步了,后面再开时又与主机不一样,则在ubuntu中settings-&gt;Date&amp;Time设置时区。</p> </td> </tr> </tbody> 

讯享网
小讯
上一篇 2025-04-23 22:02
下一篇 2025-04-19 08:23

相关推荐

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容,请联系我们,一经查实,本站将立刻删除。
如需转载请保留出处:https://51itzy.com/kjqy/199640.html