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

Including what you use is find, but not without inclusion guards #251

HBBroeker opened this issue Jul 13, 2019 · 2 comments


Copy link

commented Jul 13, 2019

As of quite recently (likely commit 3e0e62c), re2c fails to build here, because of a multiple definition error in src/parse:

make: Entering directory '/home/hbbro/src/re2c/bld/cyg/gcc'
make  all-am
make[1]: Entering directory '/home/hbbro/src/re2c/bld/cyg/gcc'
  CXX      src/parse/lex.o
In file included from ../../../re2c/src/parse/scanner.h:12:0,
                 from ../../../re2c/src/parse/
./src/parse/lex.h:12:8: error: redefinition of 'struct re2c::ScannerState'
 struct ScannerState
In file included from ../../../re2c/src/parse/
./src/parse/lex.h:12:8: note: previous definition of 'struct re2c::ScannerState'
 struct ScannerState
make[1]: *** [Makefile:2045: src/parse/lex.o] Error 1
make[1]: Leaving directory '/home/hbbro/src/re2c/bld/cyg/gcc'
make: *** [Makefile:1233: all] Error 2
make: Leaving directory '/home/hbbro/src/re2c/bld/cyg/gcc'

Including headers that define stuff used by a given header is a good approach. But it cannot really work if the headers do not have multiple-inclusion guards, i.e. like this:

// alll the contents in here ...
#endif /* RE2C_INCLUDED_LEX_H */

This comment has been minimized.

Copy link

commented Jul 13, 2019

You are absolutely right, and I have already fixed it: f979535.


This comment has been minimized.

Copy link

commented Jul 13, 2019

Fair enough ;-)

@HBBroeker HBBroeker closed this Jul 13, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.