Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
minzak opened this issue Jun 12, 2024 · 0 comments

Comments

@minzak
Copy link

minzak commented Jun 12, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant