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> void * udata = malloc(sizeof(i32s) + sizeof(fGL) * mdl->GetAtomCount() * 3);<br> <br> // first, store the number of atoms in the model, as a simple way to test data validity...<br> <br> i32s * ptr1 = (i32s *) udata;
<br> (* ptr1) = mdl->GetAtomCount();<br> <br> // then just store the coordinates...<br> <br> fGL * ptr2 = (fGL *) ( udata + sizeof(i32s)); i32s counter = 0;<br> for (iter_al it1 = mdl->GetAtomsBegin();it1 != mdl->GetAtomsEnd();it1++)
<br> {<br> const fGL * cdata = (* it1).GetCRD(cset);<br> ptr2[counter++] = cdata[0];<br> ptr2[counter++] = cdata[1];<br> ptr2[counter++] = cdata[2];<br> }<br> <br> return udata;<br>
}<br><br>void apply_udata_as_cset(project * prj, void * udata)<br>{<br> i32s * ptr1 = (i32s *) udata;<br> if (prj->GetAtomCount() != (* ptr1))<br> {<br> cout << "oops!!! the atom counts are different." << endl;
<br> return;<br> }<br> <br> fGL * ptr2 = (fGL *) ( udata + sizeof(i32s)); i32s counter = 0;<br> for (iter_al it1 = prj->GetAtomsBegin();it1 != prj->GetAtomsEnd();it1++)<br> {<br> const i32s cset = 0; // how to set this?!?!?!
<br> fGL x = ptr2[counter++];<br> fGL y = ptr2[counter++];<br> fGL z = ptr2[counter++];<br> (* it1).SetCRD(cset, x, y, z);<br> }<br> <br> prj->UpdateAllGraphicsViews();<br> <br> // also make sure that if user calculates any results, the new structure will be used!
<br> // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^<br> <br> prj->GetCurrentSetup()->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> <<a href="mailto:thassine@messi.uku.fi">thassine@messi.uku.fi</a>> 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>> Thanks for the reply Tommi,<br>> I tried to compile Ghemical 2.01 but, as always, I ran into some issues.....<br><br>> views.cpp:260: error: cast from 'void*' to 'i32u' loses precision
<br>> views.cpp: In function 'void apply_udata_as_cset(project*, void*)':<br>> views.cpp:281: error: cast from 'void*' to 'i32u' loses precision<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>> 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 *) ( udata + sizeof(i32s)); i32s counter = 0;
<br> ^^^^^^^<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> Tommi<br><br></blockquote></div><br>