<div dir="ltr"><div class="gmail_default" style="font-size:large">Hi Stefan,</div><div class="gmail_default" style="font-size:large"><br></div><div class="gmail_default" style="font-size:large">Do you know what header defines this B0 macro? It's not a problem I've ever seen. Compiler-level macros should have names prefixed by double-underscores to avoid this problem, I think, so it must be coming from a "user space" header... but which one?</div><div class="gmail_default" style="font-size:large"><br></div><div class="gmail_default" style="font-size:large">This isn't just a modularisation thing -- we already namespace these PID codes. It's more generally about inability to restrict the scope of #define and other dumb preprocessor mechanisms...</div><div class="gmail_default" style="font-size:large"><br></div><div class="gmail_default" style="font-size:large">Andy</div><div class="gmail_default" style="font-size:large"><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 2 May 2018 at 12:54, Stefan Richter <span dir="ltr"><<a href="mailto:stefan.richter@cern.ch" target="_blank">stefan.richter@cern.ch</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Dear Rivet developers,<br>
I'm experiencing a very annoying compile-time clash because the variable B0 is #defined (to 0) in a header that gets #included in Rivet… where it clashes with Rivet's PDGID definition of the neutral B meson. See the compiler printouts below.<br>
<br>
Do you have an elegant solution for this? Or should I add an #undef line to the Rivet source?<br>
<br>
Thank you!<br>
Stefan<br>
<br>
PS: I wish C++ had a module system like Python to prevent this from happening.<br>
<br>
clang++ -std=c++11 -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -pipe -Os -I/Users/stefanrichter/<wbr>Software/local/src/Rivet-2.5.<wbr>4/include -I/Users/stefanrichter/<wbr>Software/local/src/Rivet-2.5.<wbr>4/include -I/opt/local/Library/<wbr>Frameworks/Python.framework/<wbr>Versions/3.6/include/python3.<wbr>6m -c rivet/core.cpp -o build/temp.macosx-10.13-x86_<wbr>64-3.6/rivet/core.o -I/Users/stefanrichter/<wbr>Software/local/include -O2 -Wno-sign-compare -I/Users/stefanrichter/<wbr>Software/local/include -I/Users/stefanrichter/<wbr>Software/local/include -I/Users/stefanrichter/<wbr>Software/local/include -I/opt/local/include<br>
In file included from rivet/core.cpp:456:<br>
In file included from /Users/stefanrichter/Software/<wbr>local/src/Rivet-2.5.4/include/<wbr>Rivet/AnalysisHandler.hh:5:<br>
In file included from /Users/stefanrichter/Software/<wbr>local/src/Rivet-2.5.4/include/<wbr>Rivet/Config/RivetCommon.hh:<wbr>20:<br>
/Users/stefanrichter/Software/<wbr>local/src/Rivet-2.5.4/include/<wbr>Rivet/Tools/ParticleName.hh:<wbr>122:24: error: expected unqualified-id<br>
    static const PdgId B0 = 511;<br>
                       ^<br>
/usr/include/sys/termios.h:<wbr>291:12: note: expanded from macro 'B0'<br>
#define B0      0<br>
                ^<br>
1 error generated.<br>
error: command 'clang++' failed with exit status 1<br>
<br>
<br>______________________________<wbr>_________________<br>
Rivet mailing list<br>
<a href="mailto:Rivet@projects.hepforge.org">Rivet@projects.hepforge.org</a><br>
<a href="https://www.hepforge.org/lists/listinfo/rivet" rel="noreferrer" target="_blank">https://www.hepforge.org/<wbr>lists/listinfo/rivet</a><br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">Dr Andy Buckley, Lecturer / Royal Society University Research Fellow<br>Particle Physics Expt Group, University of Glasgow<br></div>
</div>