<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi, I'm fighting this issue.<div><br></div><div>In the follow code which is macro for a struct divide I get three errors about casting PetscErrorCode types into the name of the struct.</div><div><br></div><div>This is the code</div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><span style="color: #c800a7">struct</span> IMPACT_Moment Divide(<span style="color: #c800a7">struct</span> IMPACT_Moment * M1, <span style="color: #c800a7">struct</span> IMPACT_Moment * M3)</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; color: rgb(0, 140, 0); "><span style="color: #000000">{&nbsp; </span>// does M1./M3 and returns M2</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">&nbsp; PetscErrorCode ierr;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">&nbsp; <span style="color: #c800a7">struct</span> IMPACT_Moment M2;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">&nbsp; M2.Nx = M1-&gt;Nx;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">&nbsp; M2.Ny = M1-&gt;Ny;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">&nbsp; M2.coords[<span style="color: #4100e0">0</span>] = M1-&gt;coords[<span style="color: #4100e0">0</span>];</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">&nbsp; M2.coords[<span style="color: #4100e0">1</span>] = M1-&gt;coords[<span style="color: #4100e0">1</span>];</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; min-height: 13px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">78: &nbsp;ierr = VecCopy(M1-&gt;xaxis, M2.xaxis);CHKERRQ(ierr);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">79: &nbsp;ierr = VecCopy(M1-&gt;yaxis, M2.yaxis);CHKERRQ(ierr);</div><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px"><br class="webkit-block-placeholder"></p><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">81: &nbsp;ierr = MatCopy(M1-&gt;values, M2.values, DIFFERENT_NONZERO_PATTERN);CHKERRQ(ierr);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">...... goes on</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">and these are the only three error messages I get</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">IMPACTA_Moments.h: In function ‘IMPACT_Moment Divide(IMPACT_Moment*, IMPACT_Moment*)’:</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">IMPACTA_Moments.h:78: error: conversion from ‘PetscErrorCode’ to non-scalar type ‘IMPACT_Moment’ requested</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">IMPACTA_Moments.h:79: error: conversion from ‘PetscErrorCode’ to non-scalar type ‘IMPACT_Moment’ requested</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">IMPACTA_Moments.h:81: error: conversion from ‘PetscErrorCode’ to non-scalar type ‘IMPACT_Moment’ requested</div><div><br></div><div><br></div><div>Any thoughts?</div><div><br></div><div>JM</div></div></div></body></html>