<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style></head><body lang=EN-US link=blue vlink="#954F72"><div class=WordSection1><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Arduino uses gcc under the hood.</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>The error about the “for” could be a red herring. GCC is full of those. </p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Templates in C++ can be very sensitive to the proper declarations in place prior to a specialization of it.. The Arduino IDE plays games with how files are #included, which is one of the things I do not like about it, it makes things easier for beginners, at the expense on control for power users. </p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>You syntax looks correct. (as it ought to since it compiles in another environment). Try moving those lines around within the source file, or even putting them in a header files in an inline function, just short term, in an attempt to get a more clear error message. </p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p><div style='mso-element:para-border-div;border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in'><p class=MsoNormal style='border:none;padding:0in'><b>From: </b><a href="mailto:triembed@triembed.org">alex--- via TriEmbed</a><br><b>Sent: </b>Tuesday, April 21, 2020 5:33 PM<br><b>To: </b><a href="mailto:triembed@triembed.org">triembed@triembed.org</a><br><b>Subject: </b>[TriEmbed] C++ class templates in Arduino - problems</p></div><p class=MsoNormal><o:p> </o:p></p></div></body></html>Anyone familiar with class templates? Code which has no problems under clang-1100.0.33.16 appears to have trouble under whatever Arduino 1.8.9 is using as a compiler.<br /><br />Take these two lines as an example:<br /><br />Vec3<unsigned char> *frameBuffer = new Vec3<unsigned char>[imageWidth * imageHeight];<br />for (uint32_t i = 0; i < imageWidth * imageHeight; ++i) frameBuffer[i] = Vec3<unsigned char>(255);<br /><br />On Arduino, it complains the ‘for’ on the second line was unexpected. The compiler must be doing something wrong with substituting code on line 1 and losing the ‘;’ perhaps. But why?<br /><br />For those with time:<br />Arduino code is here:<br />https://github.com/quarterturn/simple-wireframe<br /><br />Linux or OSX command line code is here:<br />https://github.com/quarterturn/wireframe<br /><br />What the code does is render a 3D model as a wireframe, using surface normals for back surface culling, as well as a z-buffer for hidden line removal. On the Arduino, should I ever get it working, it will send a vector list to an Arduino Due, which will use it to draw the image on an oscilloscope in XY mode.<br /><br />I gotta get off Arduino. Only so many systicks in a day though.<br /><br />Alex<br /><br /><br /><br />_______________________________________________<br />Triangle, NC Embedded Computing mailing list<br /><br />To post message: TriEmbed@triembed.org<br />List info: http://mail.triembed.org/mailman/listinfo/triembed_triembed.org<br />TriEmbed web site: http://TriEmbed.org<br />To unsubscribe, click link and send a blank message: mailto:unsubscribe-TriEmbed@bitser.net?subject=unsubscribe<br /><br />