Linux QT umount()函数不使用';行不通

Linux QT umount()函数不使用';行不通,linux,qt,raspberry-pi,Linux,Qt,Raspberry Pi,当我写下这段代码时 int removeUSB = umount("/media/pi/USB_Device"); if(!removeUSB) qDebug()<<"USB is removed."; else qDebug()<<"USB is not removed." int removeUSB=umount(“/media/pi/USB_Device”); 如果(!removeUSB) qDebug()我相信您正在调用的umount函数不是Q

当我写下这段代码时

int removeUSB = umount("/media/pi/USB_Device");
if(!removeUSB) 
   qDebug()<<"USB is removed."; 
else 
   qDebug()<<"USB is not removed."
int removeUSB=umount(“/media/pi/USB_Device”);
如果(!removeUSB)

qDebug()我相信您正在调用的
umount
函数不是QT函数,而是glibc库提供的函数。请参阅:手册页和

这两个页面都指出,如果卸载调用未成功,它将返回-1,并将全局变量
errno
设置为错误代码。错误代码可在手册页上找到

您可以看到如下错误:

if(umount("/media/pi/USB_Device")) 
   qDebug()<<"Error removing USB Deviced: " << strerror(errno); 
else 
   qDebug()<<"USB is removed."
if(umount(“/media/pi/USB\u设备”))

qDebug()我像你说的那样重写代码。我在调试屏幕上看到一条权限消息“操作不允许”。我如何解决这个问题?这就是我在回答中提到的错误EPERM。正在运行进程的用户没有卸载权限。尝试以root用户身份运行它。