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

duplicate symbols link failure caused by not using extern in headers #1506

Open
todd-richmond opened this issue Jan 5, 2023 · 1 comment

Comments

@todd-richmond
Copy link

gcc 12 (and likely earlier compilers) fail attempting to link ag due to duplicate symbols. This is caused because structs are defined in .h files which get included into multiple .c files. The solution is to use extern foo bar; in the .h and then define in a single .c

The list includes opts, print_mtx, out_fd, stats and a slew of others

For those who need a workaround you can set LDFLAGS to "-z muldefs"

@Try2Code
Copy link

thx so much for this post 🙏 @todd-richmond

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

2 participants