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

multiple definitions #21

Open
zenorogue opened this issue Jan 15, 2021 · 1 comment
Open

multiple definitions #21

zenorogue opened this issue Jan 15, 2021 · 1 comment

Comments

@zenorogue
Copy link

When I try to compile, I get lots of "multiple definition of <something>'" errors.

This is because e.g. PHL.h defines int WHITE and thus every file which #includes PHL.h has a definition of int white, which confuses the linker. The correct version is to put int WHITE in PHL.c, while PHL.h has only a declaration (extern int WHITE). SCU would work too.

Not sure why it compiles on some compilers, IMO it should not...

This problem too many times for me to fix it correctly (lots of definitions in game.h), so I have just added add_link_options("-Wl,--allow-multiple-definition") to CMakeLists.txt, which appears to work, but probably not the correct fix.

@clort81
Copy link

clort81 commented Apr 20, 2021

thank you. ran into this too with gcc 10.2.1 on aarcht64

ugh lol. what's this fullscreen stuff.

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