gpt4 book ai didi

c++ - 无法从 nautilus 运行可执行文件

转载 作者:行者123 更新时间:2023-11-27 23:46:12 25 4
gpt4 key购买 nike

(the warning that shows up)在 Ubuntu 18.04 上,我使用 g++ test.cpp -o test 编译了一个仅包含 stdio.h 和一个空主函数的 C++ 示例.

没有弹出错误,我从终端运行它也没有问题。

但是,一旦我继续使用 nautilus 并尝试通过单击 test 来运行它,就会弹出一个警告,要求我选择一个程序来打开共享库。

我如何确保程序被编译为可执行文件/被文件管理器视为可执行文件?

编辑:可执行文件的统计输出(重新编译并将名称更改为 asdff):

File: asdff
Size: 10600 Blocks: 24 IO Block: 4096 regular file
Device: 808h/2056d Inode: 4200517 Links: 1
Access: (0755/-rwxr-xr-x) Uid: ( 1000/ miguel) Gid: ( 1000/ miguel)
Access: 2018-05-18 15:22:58.009993285 +0100
Modify: 2018-05-18 15:22:58.009993285 +0100
Change: 2018-05-18 15:22:58.009993285 +0100
Birth: -

df output on the same executable:


Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda8 128206036 102694048 18956444 85% /

desktop entry:

[Desktop Entry]
Type=Application
Encoding=UTF-8
Name=asdff
Exec=./home/miguel/Desktop/asdff
Icon=/home/miguel/Desktop/index.png

最佳答案

我注意到您正在尝试使用桌面文件。那很好。

Because Nautilus is patched to remove the ability to execute programs. It's a security problem.

将您的桌面文件放在应用程序启动器的正确位置并以这种方式打开它,而不是使用 Nautilus。这个位置是 $HOME/.local/share/applications,我相信。

关于c++ - 无法从 nautilus 运行可执行文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50412577/

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