Hi Andreas, On 04/18/2017 10:15 PM, Andreas Tille wrote: > The definition of the structure threshold_s can be found in > /usr/include/hmmer2/structs.h (of package libhmmer2-dev) and > looks like > > struct threshold_s { > float globT; /* T parameter: keep only hits > globT bits */ > double globE; /* E parameter: keep hits < globE E-value */ > float domT; /* T parameter for individual domains */ > double domE; /* E parameter for individual domains */ > /* autosetting of cutoffs using Pfam annot: */ > enum { CUT_NONE, CUT_GA, CUT_NC, CUT_TC } autocut; > int Z; /* nseq to base E value calculation on */ > };
Congratulations: you've stumbled upon a corner-case that demonstrates that C is _not_ a subset of C++. In this case, the above structure definition does very different things in C and C++ when it comes to defined names. C: there are no nested structure names, the entire namespace is flat. Any enum defined within a structure defines names that are available in the global namespace. If you include the above structure from a C file and compile it with a C compiler, the name CUT_NONE will be defined directly. C++: nested structures are a language feature, so any enum defined within a struct (or class) will only create names that are nested within that struct (or class). In this case, there will be no global name CUT_NONE, but instead a name threashold_s::CUT_NONE will exist. Unfortunately, declaring the struct within an extern "C" { } block doesn't help either, namespacing occurs regardless. So: in a .c file the code you're trying to compile should work, but you're trying to compile a .cpp file, so no dice here. To fix the issue, just use threshold_s::CUT_NONE instead of just CUT_NONE within C++ code. What's beyond me is how the code you're trying to compile came to be in its current form, as even the author would have to have stumbled over the same problem when trying to compile it. Regards, Christian