Skip to content

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

@minzak

Description

@minzak
~/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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions