compile tslib1.4,----error: call to ‘__open_missing_mode’ declared with attribute error

本文解决了一个GCC编译过程中出现的警告和错误问题,具体涉及到使用open函数时未正确提供参数导致的问题。通过调整代码,确保了当使用O_CREAT标志时,正确地指定了文件权限模式。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

problem:
---------------------
ts_calibrate.c: In function ‘main’:
ts_calibrate.c:234: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result
In file included from /usr/include/fcntl.h:205,
                 from /usr/include/sys/fcntl.h:1,
                 from ts_calibrate.c:20:
In function ‘open’,
    inlined from ‘main’ at ts_calibrate.c:227:
/usr/include/bits/fcntl2.h:51: error: call to ‘__open_missing_mode’ declared with attribute error: open with O_CREAT in second argument needs 3 arguments
In function ‘open’,
    inlined from ‘main’ at ts_calibrate.c:229:
/usr/include/bits/fcntl2.h:51: error: call to ‘__open_missing_mode’ declared with attribute error: open with O_CREAT in second argument needs 3 arguments
make[2]: *** [ts_calibrate.o] Error 1
make[2]: Leaving directory `/root/Qt_Tools/tslib/tests'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/root/Qt_Tools/tslib'
make: *** [all] Error 2
root@10.0.0.196:/root/Qt_Tools/tslib

---------------------------------------------


solution:

root@xx-desktop:~/Qt_Tools/tslib# gedit ./tests/ts_calibrate.c&

go to line227 &&line 229,


        if ((calfile = getenv("TSLIB_CALIBFILE")) != NULL) {
            cal_fd = open (calfile, O_CREAT | O_RDWR,0777));
        } else {
            cal_fd = open ("/etc/pointercal", O_CREAT | O_RDWR,0777));
        }


 Because GCC strict syntax error checking.When using then OPEN function,the 2th parameter using "O_CREAT",you must add the 3th parameter ---0777.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

sunxiaopengsun

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值