Hey Tommi,<br>Still getting some errors sadly... here is output from make:<br><br>views.cpp: In function 'void* convert_cset_to_plotting_udata(project*, i32s)':<br>views.cpp:260: error: pointer of type 'void *' used in arithmetic
<br>views.cpp: In function 'void apply_udata_as_cset(project*, void*)':<br>views.cpp:281: error: pointer of type 'void *' used in arithmetic<br>make[2]: *** [views.o] Error 1<br>make[2]: Leaving directory `/home/jason/Desktop/ghemical-
2.01/src'<br>make[1]: *** [all] Error 2<br>make[1]: Leaving directory `/home/jason/Desktop/ghemical-2.01/src'<br>make: *** [all-recursive] Error 1<br><br>And here is the modified code:<br><br>void * convert_cset_to_plotting_udata(project * mdl, i32s cset)
<br>{<br>&nbsp;&nbsp;&nbsp; void * udata = malloc(sizeof(i32s) + sizeof(fGL) * mdl-&gt;GetAtomCount() * 3);<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; // first, store the number of atoms in the model, as a simple way to test data validity...<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; i32s * ptr1 = (i32s *) udata;
<br>&nbsp;&nbsp;&nbsp; (* ptr1) = mdl-&gt;GetAtomCount();<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; // then just store the coordinates...<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; fGL * ptr2 = (fGL *) (&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; udata + sizeof(i32s)); i32s counter = 0;<br>&nbsp;&nbsp;&nbsp; for (iter_al it1 = mdl-&gt;GetAtomsBegin();it1 != mdl-&gt;GetAtomsEnd();it1++)
<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; const fGL * cdata = (* it1).GetCRD(cset);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ptr2[counter++] = cdata[0];<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ptr2[counter++] = cdata[1];<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ptr2[counter++] = cdata[2];<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; return udata;<br>
}<br><br>void apply_udata_as_cset(project * prj, void * udata)<br>{<br>&nbsp;&nbsp;&nbsp; i32s * ptr1 = (i32s *) udata;<br>&nbsp;&nbsp;&nbsp; if (prj-&gt;GetAtomCount() != (* ptr1))<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; cout &lt;&lt; &quot;oops!!! the atom counts are different.&quot; &lt;&lt; endl;
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return;<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; fGL * ptr2 = (fGL *) (&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; udata + sizeof(i32s)); i32s counter = 0;<br>&nbsp;&nbsp;&nbsp; for (iter_al it1 = prj-&gt;GetAtomsBegin();it1 != prj-&gt;GetAtomsEnd();it1++)<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; const i32s cset = 0;&nbsp;&nbsp;&nbsp; // how to set this?!?!?!
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; fGL x = ptr2[counter++];<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; fGL y = ptr2[counter++];<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; fGL z = ptr2[counter++];<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; (* it1).SetCRD(cset, x, y, z);<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; prj-&gt;UpdateAllGraphicsViews();<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; // also make sure that if user calculates any results, the new structure will be used!
<br>&nbsp;&nbsp;&nbsp; // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; prj-&gt;GetCurrentSetup()-&gt;DiscardCurrentEngine();<br>}<br><br>Thanks for your help,<br>Jason<br><br><div><span class="gmail_quote">
On 23/05/06, <b class="gmail_sendername">Tommi Hassinen</b> &lt;<a href="mailto:thassine@messi.uku.fi">thassine@messi.uku.fi</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On Wed, 17 May 2006, Jason Rigby wrote:<br><br>&gt; Thanks for the reply Tommi,<br>&gt; I tried to compile Ghemical 2.01 but, as always, I ran into some issues.....<br><br>&gt; views.cpp:260: error: cast from 'void*' to 'i32u' loses precision
<br>&gt; views.cpp: In function 'void apply_udata_as_cset(project*, void*)':<br>&gt; views.cpp:281: error: cast from 'void*' to 'i32u' loses precision<br>&gt; make[2]: *** [views.o] Error 1<br>&gt; make[2]: Leaving directory `/home/jason/Desktop/ghemical-
2.01/src'<br>&gt; make[1]: *** [all] Error 2<br>&gt; make[1]: Leaving directory `/home/jason/Desktop/ghemical-2.01/src'<br>&gt; make: *** [all-recursive] Error 1<br>&gt;<br>&gt; Again, any help would be appreciated!<br><br>
The line in question is:<br><br>fGL * ptr2 = (fGL *) ((i32u) udata + sizeof(i32s)); i32s counter = 0;<br><br>Your compiler seems to think that the pointer arithmetics is done badly.<br>Try this modification:<br><br>fGL * ptr2 = (fGL *) (&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; udata + sizeof(i32s)); i32s counter = 0;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;^^^^^^^<br>that is, just remove the int-cast that seems to be unnecessary. The same<br>for line 281.<br><br>I hope this helps,<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Tommi<br><br></blockquote></div><br>