系統 - Debian - 解決Implicit declaration of function major問題



參考資訊:
https://github.com/hishamhm/htop/issues/663

問題如下:

qemu/linux-user/strace.c: In function ‘print_mknod’:
qemu/linux-user/strace.c:1050:39: warning: implicit declaration of function ‘major’ [-Wimplicit-function-declaration]
         print_raw_param("makedev(%d", major(arg2), 0);
                                       ^~~~~
qemu/linux-user/strace.c:1050:39: warning: nested extern declaration of ‘major’ [-Wnested-externs]
qemu/linux-user/strace.c:1051:32: warning: implicit declaration of function ‘minor’; did you mean ‘mknod’? [-Wimplicit-function-declaration]
         print_raw_param("%d)", minor(arg2), 1);
                                ^~~~~
                                mknod
qemu/linux-user/strace.c:1051:32: warning: nested extern declaration of ‘minor’ [-Wnested-externs]

解法如下:

#include <sys/sysmacros.h>