将图标添加到 gcc 可执行文件并在终端中打开
我编写了一个程序,通过蓝牙连接到设备,并使用 gcc 中的纯 C 将数据发送到网络。我现在无法在代码中实现任何 GUI 部分,但我需要将其部署到测试用户进行测试。我想要带有图标的可执行文件,以便用户可以单击可执行文件并且程序在终端中启动。如何向可执行文件添加图标并在终端中启动程序?
抱歉我之前没有提到它在 Ubuntu Linux 中
I made a program to connect to a device via Bluetooth and send the data to the web using pure C in gcc. I won't be able to implement any GUI portion in the code right now but I need to deploy it to test users for testing. I want to have the executable with an icon so that a user can click on the executable and the program starts in the terminal. How do I add an icon to the executable and start the program in the terminal?
Sorry I failed to mention before that its in Ubuntu Linux
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
本文档介绍了如何将程序添加到程序菜单:http://standards.freedesktop。 org/menu-spec/latest/.
This document explains how to add your program to the programs menu: http://standards.freedesktop.org/menu-spec/latest/.
如果这是您正在制作的 Windows 可执行文件,您需要做的是使用资源编译器来制作一个目标文件,其中包含您想要的资源(在本例中为图标),然后您可以正常链接到您的程序。我在 Windows 上使用 gcc 构建程序时使用的资源编译器称为
windres
。我发现在处理名称中带有空格的目录时非常挑剔。提防!
If this is a Windows executable you're making, what you need to do is to use a resource compiler to make an object file that includes the resources you want (an icon in this case) which you can then link into your program as normal. The resource compiler I've used when building programs on Windows with gcc was called
windres
.I found it to be very finicky when dealing with directories with spaces in the name. Beware!