<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p>I get the same errors with g++ (v. 6.3). I can't find what kind
      of compiler flag I can use to be able to compile this. It clearly
      comes from how C++ deals with enum. The solutions I've found
      consist in "static_casting" the int values... Modifying my local
      version of lustre_user.h is probably not the best idea :-)</p>
    <p><br>
    </p>
    <br>
    <div class="moz-cite-prefix">On 03/15/2017 02:14 PM, Patrick Farrell
      wrote:<br>
    </div>
    <blockquote
cite="mid:CY4PR11MB17514EC65FBB8A1D61378872CB270@CY4PR11MB1751.namprd11.prod.outlook.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=windows-1252">
      <meta name="Generator" content="Microsoft Exchange Server">
      <!-- converted from text -->
      <style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
      <meta content="text/html; charset=UTF-8">
      <style type="text/css" style="">
<!--
p
        {margin-top:0;
        margin-bottom:0}
-->
</style>
      <div dir="ltr">
        <div id="x_divtagdefaultwrapper" dir="ltr"
          style="font-size:12pt; color:#000000;
          font-family:Calibri,Arial,Helvetica,sans-serif">
          <p>It looks like your compiler is being fussier than the C
            compiler.</p>
          <p><br>
          </p>
          <p>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.</p>
          <p><br>
          </p>
          <p>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.<br>
            <br>
            You might also try a different C++ compiler, to see if it
            has a different attitude towards that error.</p>
          <p><br>
          </p>
          <p>One further thought, though:<br>
            This is a C header.  Presumably, it is not intended to be
            included directly in a C++ project?</p>
          <p><br>
          </p>
          <p>- Patrick</p>
        </div>
        <hr tabindex="-1" style="display:inline-block; width:98%">
        <div id="x_divRplyFwdMsg" dir="ltr"><font style="font-size:11pt"
            face="Calibri, sans-serif" color="#000000"><b>From:</b>
            lustre-discuss
            <a class="moz-txt-link-rfc2396E" href="mailto:lustre-discuss-bounces@lists.lustre.org"><lustre-discuss-bounces@lists.lustre.org></a> on behalf of
            François Tessier <a class="moz-txt-link-rfc2396E" href="mailto:ftessier@anl.gov"><ftessier@anl.gov></a><br>
            <b>Sent:</b> Wednesday, March 15, 2017 2:00:31 PM<br>
            <b>To:</b> <a class="moz-txt-link-abbreviated" href="mailto:lustre-discuss@lists.lustre.org">lustre-discuss@lists.lustre.org</a><br>
            <b>Subject:</b> [lustre-discuss] Compile a C++ app. using
            the Lustre API</font>
          <div> </div>
        </div>
      </div>
      <font size="2"><span style="font-size:10pt;">
          <div class="PlainText">Hi All,<br>
            <br>
            I'm working on a piece of code using the Lustre API. To do
            so, I include<br>
            lustreapi.h. When I compile my code with a C compiler (icc),
            everything<br>
            is fine. However, when I compile it with a C++ compiler
            (icpc), I get<br>
            these errors:<br>
            <br>
            ---------------------------------<br>
            <br>
            In file included from /usr/include/lustre/lustreapi.h(47),<br>
                             from topo.c(5):<br>
            /usr/include/lustre/lustre_user.h(914): error: argument of
            type "__u16={unsigned short}" is incompatible with parameter
            of type "changelog_rec_flags"<br>
                     return changelog_rec_offset(rec->cr_flags);<br>
                                                 ^<br>
            <br>
            In file included from /usr/include/lustre/lustreapi.h(47),<br>
                             from topo.c(5):<br>
            /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"<br>
                     enum changelog_rec_flags crf = rec->cr_flags
            & CLF_VERSION;<br>
                                                    ^<br>
            <br>
            In file included from /usr/include/lustre/lustreapi.h(47),<br>
                             from topo.c(5):<br>
            /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"<br>
                     enum changelog_rec_flags crf = rec->cr_flags
            &<br>
                                                    ^<br>
            <br>
            In file included from /usr/include/lustre/lustreapi.h(47),<br>
                             from topo.c(5):<br>
            /usr/include/lustre/lustre_user.h(945): error: argument of
            type "int" is incompatible with parameter of type
            "changelog_rec_flags"<br>
                     return (char *)rec +
            changelog_rec_offset(rec->cr_flags &<br>
                                                               ^<br>
            <br>
            In file included from /usr/include/lustre/lustreapi.h(47),<br>
                             from topo.c(5):<br>
            /usr/include/lustre/lustre_user.h(986): error: this
            operation on an enumerated type requires an applicable
            user-defined operator function<br>
                     crf_wanted &= CLF_SUPPORTED;<br>
                                ^<br>
            <br>
            In file included from /usr/include/lustre/lustreapi.h(47),<br>
                             from topo.c(5):<br>
            /usr/include/lustre/lustre_user.h(997): error: argument of
            type "int" is incompatible with parameter of type
            "changelog_rec_flags"<br>
                               changelog_rec_offset(crf_wanted &
            ~CLF_JOBID);<br>
                                                    ^<br>
            <br>
            In file included from /usr/include/lustre/lustreapi.h(47),<br>
                             from topo.c(5):<br>
            /usr/include/lustre/lustre_user.h(999): error: argument of
            type "int" is incompatible with parameter of type
            "changelog_rec_flags"<br>
                               changelog_rec_offset(crf_wanted &
            ~(CLF_JOBID | CLF_RENAME));<br>
                                                    ^<br>
            <br>
            Makefile:10: recipe for target 'topo' failed<br>
            make: *** [topo] Error 2<br>
            <br>
            ---------------------------------<br>
            <br>
            It's probably more a compiler issue than a Lustre one but a
            solution<br>
            could help other users or Lustre developers.<br>
            <br>
            Any idea?<br>
            <br>
            Thanks,<br>
            <br>
            François<br>
            <br>
            <br>
            -- <br>
            --<br>
            François TESSIER, Ph.D.<br>
            Postdoctoral Appointee<br>
            Argonne National Laboratory<br>
            LCF Division - Bldg 240, 4E 19<br>
            Tel : +1 (630)-252-5068<br>
            <a moz-do-not-send="true"
              href="http://www.francoistessier.info">http://www.francoistessier.info</a><br>
            <br>
            _______________________________________________<br>
            lustre-discuss mailing list<br>
            <a class="moz-txt-link-abbreviated" href="mailto:lustre-discuss@lists.lustre.org">lustre-discuss@lists.lustre.org</a><br>
            <a moz-do-not-send="true"
              href="http://lists.lustre.org/listinfo.cgi/lustre-discuss-lustre.org">http://lists.lustre.org/listinfo.cgi/lustre-discuss-lustre.org</a><br>
          </div>
        </span></font>
    </blockquote>
    <br>
  </body>
</html>