<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: C2801 Error on Variable Declaration in 8-bit Microcontrollers</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/C2801-Error-on-Variable-Declaration/m-p/132188#M2958</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;The Broad Lea wrote:&lt;BR /&gt;&lt;P&gt;. . . I'm so ashamed!&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;Actually, it is Metrowerks that should be ashamed.&lt;BR /&gt;&lt;BR /&gt;First, for not allowing you to put the declarations where you want.&lt;BR /&gt;&lt;BR /&gt;Second, for complaining about it with such a misleading error message.&lt;BR /&gt;&lt;BR /&gt;(just my meaningless opinion)&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 12 Apr 2006 07:13:37 GMT</pubDate>
    <dc:creator>rocco</dc:creator>
    <dc:date>2006-04-12T07:13:37Z</dc:date>
    <item>
      <title>C2801 Error on Variable Declaration</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/C2801-Error-on-Variable-Declaration/m-p/132185#M2955</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Below is some Processor Expert-generated code.&amp;nbsp; I have a CAN bean (MainboardCan)&amp;nbsp;and a PIT bean (MainTimer).&amp;nbsp; The only change I have made to the code is to add a single &lt;SPAN style="font-family: 'Courier New';"&gt;int&lt;/SPAN&gt; declaration, and the compiler gives me a C2801 error: '}' missing.&lt;/P&gt;&lt;PRE&gt;/* Including used modules for compiling procedure */#include "Cpu.h"#include "Events.h"#include "MainboardCan.h"#include "MainTimer.h"/* Include shared modules, which are used for whole project */#include "PE_Types.h"#include "PE_Error.h"#include "PE_Const.h"#include "IO_Map.h"void main(void){&amp;nbsp; /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/&amp;nbsp; PE_low_level_init();&amp;nbsp; /*** End of Processor Expert internal initialization.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ***/&amp;nbsp; /* Write your code here */&amp;nbsp; int yeldarb;&amp;nbsp; /* &amp;lt;--------- ERROR C2801 ????&amp;nbsp; */&amp;nbsp; /*** Don't write any code pass this line, or it will be deleted during code generation. ***/&amp;nbsp; /*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/&amp;nbsp; for(;;){}&amp;nbsp; /*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/} /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/&lt;/PRE&gt;&lt;P&gt;Config:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;CW5.0 for HC08 with patch 1, build 060222&lt;/LI&gt;&lt;LI&gt;PE v2.97.01 with patches 1 &amp;amp; 2&lt;/LI&gt;&lt;LI&gt;Small memory model&lt;/LI&gt;&lt;LI&gt;Chip: MC68HC08AZ32A&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;FYI, when I change the type to, say, a &lt;SPAN style="font-family: 'Courier New';"&gt;byte&lt;/SPAN&gt;, the compiler throws a C1815 error, telling me that there's no such typedef as &lt;SPAN style="font-family: 'Courier New';"&gt;byte&lt;/SPAN&gt;.&amp;nbsp; Now, I can right-click on &lt;SPAN style="font-family: 'Courier New';"&gt;byte&lt;/SPAN&gt;, and the editor will take me straight to its typedef in PE_Types.h.&amp;nbsp; The compiler, however, can't seem to find it.&amp;nbsp; Pretty flakey.&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;&lt;P&gt;Thanks much for your help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Apr 2006 22:22:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/C2801-Error-on-Variable-Declaration/m-p/132185#M2955</guid>
      <dc:creator>TheBroadLea</dc:creator>
      <dc:date>2006-04-11T22:22:00Z</dc:date>
    </item>
    <item>
      <title>Re: C2801 Error on Variable Declaration</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/C2801-Error-on-Variable-Declaration/m-p/132186#M2956</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Hi:&lt;BR /&gt;&lt;BR /&gt;The problem is trying to define the variable after the call to the a function in the main() function.&lt;BR /&gt;&lt;BR /&gt;If you put&lt;BR /&gt;&lt;BR /&gt;&lt;B&gt;&lt;BR /&gt;int yeldarb;&lt;/B&gt; &lt;BR /&gt;&lt;BR /&gt;before the &lt;B&gt;PE_low_level_init();&lt;/B&gt; , you won't have any problem.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Alex.&lt;P&gt;Message Edited by alex_spotw on &lt;SPAN class="date_text"&gt;04-11-2006&lt;/SPAN&gt;&lt;SPAN class="time_text"&gt;10:28 AM&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Apr 2006 22:27:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/C2801-Error-on-Variable-Declaration/m-p/132186#M2956</guid>
      <dc:creator>alex_spotw</dc:creator>
      <dc:date>2006-04-11T22:27:48Z</dc:date>
    </item>
    <item>
      <title>Re: C2801 Error on Variable Declaration</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/C2801-Error-on-Variable-Declaration/m-p/132187#M2957</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;P&gt;Doh!&lt;/P&gt;&lt;P&gt;[sigh]&amp;nbsp; Forgive the stupid-user question.&amp;nbsp; I guess I've been working too long&amp;nbsp;in C++ and Java and JavaScript and VB and about any other language out there that doesn't care where you declare something.&amp;nbsp; I'm so ashamed!&lt;/P&gt;&lt;P&gt;Thanks.&amp;nbsp; I'll go back to work here with my tail between my legs.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Apr 2006 22:48:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/C2801-Error-on-Variable-Declaration/m-p/132187#M2957</guid>
      <dc:creator>TheBroadLea</dc:creator>
      <dc:date>2006-04-11T22:48:31Z</dc:date>
    </item>
    <item>
      <title>Re: C2801 Error on Variable Declaration</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/C2801-Error-on-Variable-Declaration/m-p/132188#M2958</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;The Broad Lea wrote:&lt;BR /&gt;&lt;P&gt;. . . I'm so ashamed!&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;Actually, it is Metrowerks that should be ashamed.&lt;BR /&gt;&lt;BR /&gt;First, for not allowing you to put the declarations where you want.&lt;BR /&gt;&lt;BR /&gt;Second, for complaining about it with such a misleading error message.&lt;BR /&gt;&lt;BR /&gt;(just my meaningless opinion)&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Apr 2006 07:13:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/C2801-Error-on-Variable-Declaration/m-p/132188#M2958</guid>
      <dc:creator>rocco</dc:creator>
      <dc:date>2006-04-12T07:13:37Z</dc:date>
    </item>
    <item>
      <title>Re: C2801 Error on Variable Declaration</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/C2801-Error-on-Variable-Declaration/m-p/132189#M2959</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hello&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;In that case Freescale compiler is fully ANSI C compliant.&lt;/DIV&gt;&lt;DIV&gt;ANSI C standard does not allow you to define a variable between two instructions&lt;/DIV&gt;&lt;DIV&gt;or assignments.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Local variable definition are only allowed at the beginning of a block.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;CrasyCat.&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Apr 2006 16:18:02 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/C2801-Error-on-Variable-Declaration/m-p/132189#M2959</guid>
      <dc:creator>CrasyCat</dc:creator>
      <dc:date>2006-04-12T16:18:02Z</dc:date>
    </item>
    <item>
      <title>Re: C2801 Error on Variable Declaration</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/C2801-Error-on-Variable-Declaration/m-p/132190#M2960</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;I do have to conceded the point on the ANSI spec.&amp;nbsp; As I mentioned, I had just forgotten about that constraint in C.&amp;nbsp; However, the error message could certainly be better, i.e., actually tell me what the problem is instead of handing me this cryptic missing-brace thing.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;It doesn't matter now.&amp;nbsp; I know what the problem is, and anybody else who runs into it in the future will have this forum thread.&amp;nbsp; All's well.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thanks, all.&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Apr 2006 19:39:30 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/C2801-Error-on-Variable-Declaration/m-p/132190#M2960</guid>
      <dc:creator>TheBroadLea</dc:creator>
      <dc:date>2006-04-12T19:39:30Z</dc:date>
    </item>
    <item>
      <title>Re: C2801 Error on Variable Declaration</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/C2801-Error-on-Variable-Declaration/m-p/132191#M2961</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;"It doesn't matter now.&amp;nbsp; I know what the problem is, and anybody else who runs into it in the future will have this forum thread."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And that would be me. Thank you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Mar 2009 22:23:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/C2801-Error-on-Variable-Declaration/m-p/132191#M2961</guid>
      <dc:creator>eJames</dc:creator>
      <dc:date>2009-03-04T22:23:34Z</dc:date>
    </item>
    <item>
      <title>Re: C2801 Error on Variable Declaration</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/C2801-Error-on-Variable-Declaration/m-p/132192#M2962</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yeh, I had same annoying problem. I was trying to declare a "byte" type variable in an ISR after assignment statement in ISR. When I moved it to a first line in that ISR it worked! So yes it has to be first item in a block.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 May 2010 01:26:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/C2801-Error-on-Variable-Declaration/m-p/132192#M2962</guid>
      <dc:creator>Coderunner</dc:creator>
      <dc:date>2010-05-18T01:26:08Z</dc:date>
    </item>
    <item>
      <title>Re: C2801 Error on Variable Declaration</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/C2801-Error-on-Variable-Declaration/m-p/132193#M2963</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, 2014. I too had the same problem.&amp;nbsp; Thanks to all on this thread.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Mar 2014 02:39:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/C2801-Error-on-Variable-Declaration/m-p/132193#M2963</guid>
      <dc:creator>hawk</dc:creator>
      <dc:date>2014-03-04T02:39:13Z</dc:date>
    </item>
  </channel>
</rss>

