<div><font>This is EXACTLY the CRUX of the matter, with this precompile command, there is no more error! Thanks for your patience with my numerous and continuous questions.</font></div><div><font><br></font></div><div><font>Je vous remercie !! </font></div><div><includetail><div> </div><div> </div><div style="font:Verdana normal 14px;color:#000;"><div style="FONT-SIZE: 12px;FONT-FAMILY: Arial Narrow;padding:2px 0 2px 0;">------------------ Original ------------------</div><div style="FONT-SIZE: 12px;background:#efefef;padding:8px;"><div id="menu_sender"><b>From: </b> "Barry Smith"<bsmith@petsc.dev>;</div><div><b>Date: </b> Wed, Jun 28, 2023 10:24 AM</div><div><b>To: </b> "冯上玮"<fengshw3@mail2.sysu.edu.cn>; <wbr></div><div><b>Cc: </b> "Matthew Knepley"<knepley@gmail.com>; "petsc-users"<petsc-users@mcs.anl.gov>; <wbr></div><div><b>Subject: </b> Re: [petsc-users] Problem in some macro when using VS+intel cl</div></div><div> </div><div style="position:relative;"><div id="tmpcontent_res"></div><div><br></div> The macros expand differently depending on the compiler being used. In this case<div><br></div><div><div>#if defined(PETSC_HAVE_BUILTIN_EXPECT)</div><div> #define PetscUnlikely(cond) __builtin_expect(!!(cond), 0)</div><div> #define PetscLikely(cond) __builtin_expect(!!(cond), 1)</div><div>#else</div><div> #define PetscUnlikely(cond) (cond)</div><div> #define PetscLikely(cond) (cond)</div><div>#endif</div></div><div><br></div><div>So with Microsoft Windows compilers, if they do not support built_inexpect the compiler will only see the #else for the macro thus the compiler would never see the __builtin_expect</div><div><br></div><div>You can check in $PETSC_DIR/$PETSC_ARCH/include/petscconf.h and see if PETSC_HAVE_BUILTIN_EXPECT is defined. ./configure determines if this (and many other) features are supported by the compiler. It is conceivable that somehow configure determined incorrectly that this is supported.</div><div><br></div><div><br></div><div><br></div><div><div><br><blockquote type="cite"><div>On Jun 27, 2023, at 10:09 PM, 冯上玮 <fengshw3@mail2.sysu.edu.cn> wrote:</div><br class="Apple-interchange-newline"><div><div>I've followed your advice and include the header's file and libraries in Visual Studio. Such "error" still shows but I can build the project! It's strange!</div><div><div>I expand the CHKERRQ macro and find the error actually locates at</div><div><br></div><div><span id="cid:2F07716E@673DAE5F.6C969B6400000000.bmp"><2F07716E@673DAE5F.6C969B6400000000.bmp></span></div><div> </div><div>What I know from google is that the "__builtin_expect__" is defined in GCC, so is it unsolvable in Windows with visual studio C compiler or Inter C compiler?</div><div style=""><div style="FONT-SIZE: 12px;FONT-FAMILY: Arial Narrow;padding:2px 0 2px 0;">------------------ Original ------------------</div><div style="FONT-SIZE: 12px;background:#efefef;padding:8px;"><div id="menu_sender"><b>From: </b> "Matthew Knepley"<knepley@gmail.com>;</div><div><b>Date: </b> Wed, Jun 28, 2023 01:59 AM</div><div><b>To: </b> "冯上玮"<fengshw3@mail2.sysu.edu.cn>; <wbr></div><div><b>Cc: </b> "petsc-users"<petsc-users@mcs.anl.gov>; <wbr></div><div><b>Subject: </b> Re: [petsc-users] Problem in some macro when using VS+intel cl</div></div><div> </div><div style="position:relative;"><div id="tmpcontent_res"></div><div dir="ltr"><div dir="ltr">On Tue, Jun 27, 2023 at 11:32 AM 冯上玮 <<a href="mailto:fengshw3@mail2.sysu.edu.cn">fengshw3@mail2.sysu.edu.cn</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><font><div style="font-family:"lucida Grande",Verdana">Hi, </div><div style="font-family:"lucida Grande",Verdana"><br></div><div style="font-family:"lucida Grande",Verdana">After failure with MS-MPI once and once again, I tried icl+oneAPI and succeeded in installing and testing PESTc in Cygwin!</div><div style="font-family:"lucida Grande",Verdana"><br></div><div style="font-family:"lucida Grande",Verdana">However, (always however<img src="https://rescdn.qqmail.com/bizmail/zh_CN/images/mo/EMOJI/009.png" style="border: none; vertical-align: middle;" onerror="">) when I copied the example code on Getting Started page on visual studio, there are tons of error like:</div><div style="font-family:"lucida Grande",Verdana"><span id="cid:CCB1C477@3FC4424F.6C969B6400000000.jpg"><CCB1C477@3FC4424F.6C969B6400000000.jpg></span></div><div style="font-family:"lucida Grande",Verdana"><u></u><div>I just wonder where the problem locates, I've googled this error message and it seems that it's induced by the difference of compilers, c.f. <a href="https://stackoverflow.com/questions/42136395/identifier-builtin-expect-is-undefined-during-ros-on-win-tutorial-talker-ex" style="outline:none;color:rgb(42,88,111)" target="_blank">https://stackoverflow.com/questions/42136395/identifier-builtin-expect-is-undefined-during-ros-on-win-tutorial-talker-ex</a>. But Intel says that they also provide such thing on icl, and I actually use this compiler instead of visual studio cl... </div></div></font></div></blockquote><div><br></div><div>The IDE is not showing the actual error message. Are you sure that your IDE build has the right includes and libraries? You can</div><div>get these using</div><div><br></div><div> cd $PETSC_DIR</div><div> make getincludedirs</div><div> make getlinklibs</div><div><br></div><div> Thanks,</div><div><br></div><div> Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><font><div style="font-family:"lucida Grande",Verdana"><div>Anyway, the project could be built if I delete these error-checking macro.</div><div><br></div><div>Installing feedback (or as a test result):</div><div>When configure on windows, only icl + impi works, and in this case, both --with-cc and --with-cxx options need to point out the version like: --with-cc-std-c99 and --with-cxx-std-c++'ver'. Other combinations such as cl + impi, icl + msmpi, cl + msmpi never work. My tutor told me that older version of msmpi may work but I never try this.</div><div><br></div><div>FENG.</div><u></u></div></font></div><div><u></u><u></u></div></blockquote></div><br clear="all"><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div><div><br></div><div><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>
</div></div></div></div></blockquote></div><br></div>
</div></div><!--<![endif]--></includetail></div>