It looks like your compiler is being fussier than the C compiler.
Specifically, the problem appears to be with the enum type. The C compiler is happy to let pass using a short (cr_flags) where an enum is called for (argument to changelog_rec_offset). In C, I think an enum is an int (so passing in a short like this is always fine). I guess in C++ either enum is not an int, or it's just fussier. There might be a compiler flag to make it not error on this? I am not familiar with icpc, so I can't help with specifics. You might also try a different C++ compiler, to see if it has a different attitude towards that error. One further thought, though: This is a C header. Presumably, it is not intended to be included directly in a C++ project? - Patrick ________________________________ From: lustre-discuss <[email protected]> on behalf of François Tessier <[email protected]> Sent: Wednesday, March 15, 2017 2:00:31 PM To: [email protected] Subject: [lustre-discuss] Compile a C++ app. using the Lustre API Hi All, I'm working on a piece of code using the Lustre API. To do so, I include lustreapi.h. When I compile my code with a C compiler (icc), everything is fine. However, when I compile it with a C++ compiler (icpc), I get these errors: --------------------------------- In file included from /usr/include/lustre/lustreapi.h(47), from topo.c(5): /usr/include/lustre/lustre_user.h(914): error: argument of type "__u16={unsigned short}" is incompatible with parameter of type "changelog_rec_flags" return changelog_rec_offset(rec->cr_flags); ^ In file included from /usr/include/lustre/lustreapi.h(47), from topo.c(5): /usr/include/lustre/lustre_user.h(925): error: a value of type "int" cannot be used to initialize an entity of type "changelog_rec_flags" enum changelog_rec_flags crf = rec->cr_flags & CLF_VERSION; ^ In file included from /usr/include/lustre/lustreapi.h(47), from topo.c(5): /usr/include/lustre/lustre_user.h(935): error: a value of type "int" cannot be used to initialize an entity of type "changelog_rec_flags" enum changelog_rec_flags crf = rec->cr_flags & ^ In file included from /usr/include/lustre/lustreapi.h(47), from topo.c(5): /usr/include/lustre/lustre_user.h(945): error: argument of type "int" is incompatible with parameter of type "changelog_rec_flags" return (char *)rec + changelog_rec_offset(rec->cr_flags & ^ In file included from /usr/include/lustre/lustreapi.h(47), from topo.c(5): /usr/include/lustre/lustre_user.h(986): error: this operation on an enumerated type requires an applicable user-defined operator function crf_wanted &= CLF_SUPPORTED; ^ In file included from /usr/include/lustre/lustreapi.h(47), from topo.c(5): /usr/include/lustre/lustre_user.h(997): error: argument of type "int" is incompatible with parameter of type "changelog_rec_flags" changelog_rec_offset(crf_wanted & ~CLF_JOBID); ^ In file included from /usr/include/lustre/lustreapi.h(47), from topo.c(5): /usr/include/lustre/lustre_user.h(999): error: argument of type "int" is incompatible with parameter of type "changelog_rec_flags" changelog_rec_offset(crf_wanted & ~(CLF_JOBID | CLF_RENAME)); ^ Makefile:10: recipe for target 'topo' failed make: *** [topo] Error 2 --------------------------------- It's probably more a compiler issue than a Lustre one but a solution could help other users or Lustre developers. Any idea? Thanks, François -- -- François TESSIER, Ph.D. Postdoctoral Appointee Argonne National Laboratory LCF Division - Bldg 240, 4E 19 Tel : +1 (630)-252-5068 http://www.francoistessier.info _______________________________________________ lustre-discuss mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-discuss-lustre.org
_______________________________________________ lustre-discuss mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-discuss-lustre.org
