dump icon indicating copy to clipboard operation
dump copied to clipboard

udpclient.c:31:6: error: conflicting types for 'gettid' (ChatGPT4 fix it for me!)

Open minzak opened this issue 1 year ago • 0 comments

~/dump/how-to-receive-a-packet$ ./build.sh
udpclient.c:31:6: error: conflicting types for 'gettid'
long gettid() { return syscall(SYS_gettid); }
     ^
/usr/include/x86_64-linux-gnu/bits/unistd_ext.h:34:16: note: previous declaration is here
extern __pid_t gettid (void) __THROW;
               ^
udpclient.c:73:16: warning: format specifies type 'long' but the argument has type '__pid_t' (aka 'int') [-Wformat]
                                 getpid(), gettid(), packet_no);
                                           ^~~~~~~~
/usr/include/x86_64-linux-gnu/bits/stdio2.h:61:31: note: expanded from macro 'snprintf'
                            __glibc_objsize (str), __VA_ARGS__)
                                                   ^~~~~~~~~~~
1 warning and 1 error generated.

Here was a error, and no binary file was. I'm ask how to fix it in Copilot, and I found worked decision.

Screenshot_20240612_164519

After that almost all is fine:

./build.sh
udpclient.c:73:16: warning: format specifies type 'long' but the argument has type '__pid_t' (aka 'int') [-Wformat]
                                 getpid(), gettid(), packet_no);
                                           ^~~~~~~~
/usr/include/x86_64-linux-gnu/bits/stdio2.h:61:31: note: expanded from macro 'snprintf'
                            __glibc_objsize (str), __VA_ARGS__)
                                                   ^~~~~~~~~~~
1 warning generated.

https://sl.bing.net/jEm33FtTJv2

minzak avatar Jun 12 '24 14:06 minzak