<?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>MCUXpresso IDE中的主题 Re: Basic question about strcpy with MCUxpresso:</title>
    <link>https://community.nxp.com/t5/MCUXpresso-IDE/Basic-question-about-strcpy-with-MCUxpresso/m-p/739855#M1466</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hani,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks for&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;taking the time&lt;/SPAN&gt;&lt;SPAN&gt;. if I don't do char before destination, it complains about it missing (see below).&amp;nbsp;&lt;/SPAN&gt;I tried&amp;nbsp;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;&lt;SPAN style="color: #0000ff;"&gt;strcpy(LCD_TXT[0], "def")&lt;/SPAN&gt;&amp;nbsp;in&amp;nbsp;a different environment (both Arduino gcc and Qt) - everything is fine. however&amp;nbsp;in MCUxpresso I get the error above; below you have the errors for both suggestions you mentioned:&lt;/SPAN&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;376:&amp;nbsp; &amp;nbsp; char LCD_TXT[2][21];&lt;BR /&gt;377:&amp;nbsp; &amp;nbsp; strcpy(LCD_TXT[0], (char*) "def");&lt;BR /&gt;378:&amp;nbsp; &amp;nbsp; strcpy(LCD_TXT[1], "tuv");&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;expected declaration specifiers or '...' before '(' token main.c /MKL26Z128xxx4_Project/source line 377 C/C++ Problem&lt;BR /&gt;expected declaration specifiers or '...' before 'LCD_TXT' main.c /MKL26Z128xxx4_Project/source line 377 C/C++ Problem&lt;BR /&gt;expected declaration specifiers or '...' before 'LCD_TXT' main.c /MKL26Z128xxx4_Project/source line 378 C/C++ Problem&lt;BR /&gt;expected declaration specifiers or '...' before string constant main.c /MKL26Z128xxx4_Project/source line 378 C/C++ Problem&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 21 Dec 2017 21:45:51 GMT</pubDate>
    <dc:creator>marianiordan</dc:creator>
    <dc:date>2017-12-21T21:45:51Z</dc:date>
    <item>
      <title>Basic question about strcpy with MCUxpresso:</title>
      <link>https://community.nxp.com/t5/MCUXpresso-IDE/Basic-question-about-strcpy-with-MCUxpresso/m-p/739851#M1462</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Basic question about strcpy: I am using MCUxpresso IDE 10.0 for KL26z128 processor, and&amp;nbsp;I am getting a compile error on following piece of code - need some help with it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;376: &amp;nbsp;char LCD_TXT[2][21];&lt;BR /&gt;377: &amp;nbsp;strcpy(LCD_TXT[0], 'def');&lt;BR /&gt;378: &amp;nbsp;strcpy(LCD_TXT[1], 'tuv');&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;Description Resource Path Location Type&lt;BR /&gt;expected declaration specifiers or '...' before '\x646566' main.c /MKL26Z128xxx4_Project/source line 377 C/C++ Problem&lt;BR /&gt;expected declaration specifiers or '...' before '\x747576' main.c /MKL26Z128xxx4_Project/source line 378 C/C++ Problem&lt;BR /&gt;expected declaration specifiers or '...' before 'LCD_TXT' main.c /MKL26Z128xxx4_Project/source line 377 C/C++ Problem&lt;BR /&gt;expected declaration specifiers or '...' before 'LCD_TXT' main.c /MKL26Z128xxx4_Project/source line 378 C/C++ Problem&lt;BR /&gt;make: *** [source/main.o] Error 1 MKL26Z128xxx4_Project C/C++ Problem&lt;BR /&gt;recipe for target 'source/main.o' failed subdir.mk /MKL26Z128xxx4_Project/Debug/source line 18 C/C++ Problem&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;if changing as below (and corrected is as per Eric's comments - 12/21), output is slightly different, though still failing:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;376:&amp;nbsp; &amp;nbsp; char LCD_TXT[2][21];&lt;BR /&gt;377:&amp;nbsp; &amp;nbsp; strcpy(char LCD_TXT[0], char "def");&lt;BR /&gt;378:&amp;nbsp; &amp;nbsp; strcpy(char LCD_TXT[1], char "tuv");&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;Description Resource Path Location Type&lt;BR /&gt;expected ';', ',' or ')' before string constant main.c /MKL26Z128xxx4_Project/source line 377 C/C++ Problem&lt;BR /&gt;expected ';', ',' or ')' before string constant main.c /MKL26Z128xxx4_Project/source line 378 C/C++ Problem&lt;BR /&gt;make: *** [source/main.o] Error 1 MKL26Z128xxx4_Project C/C++ Problem&lt;BR /&gt;recipe for target 'source/main.o' failed subdir.mk /MKL26Z128xxx4_Project/Debug/source line 18 C/C++ Problem&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Dec 2017 05:14:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-IDE/Basic-question-about-strcpy-with-MCUxpresso/m-p/739851#M1462</guid>
      <dc:creator>marianiordan</dc:creator>
      <dc:date>2017-12-21T05:14:42Z</dc:date>
    </item>
    <item>
      <title>Re: Basic question about strcpy with MCUxpresso:</title>
      <link>https://community.nxp.com/t5/MCUXpresso-IDE/Basic-question-about-strcpy-with-MCUxpresso/m-p/739852#M1463</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;'def' is a multi-byte character, not a string (or array of char).&lt;/P&gt;&lt;P&gt;You have to use double quotes:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; strcpy(LCD_TXT[0], "def");&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; strcpy(LCD_TXT[1], "tuv");&lt;/P&gt;&lt;P&gt;I hope this helps,&lt;/P&gt;&lt;P&gt;Erich&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Dec 2017 09:36:41 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-IDE/Basic-question-about-strcpy-with-MCUxpresso/m-p/739852#M1463</guid>
      <dc:creator>BlackNight</dc:creator>
      <dc:date>2017-12-21T09:36:41Z</dc:date>
    </item>
    <item>
      <title>Re: Basic question about strcpy with MCUxpresso:</title>
      <link>https://community.nxp.com/t5/MCUXpresso-IDE/Basic-question-about-strcpy-with-MCUxpresso/m-p/739853#M1464</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Eric, thanks for the correction, though still does not solve the error:&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;strcpy(char LCD_TXT[0], char "def");&lt;/P&gt;&lt;P&gt;strcpy(char LCD_TXT[1], char "tuv");&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;Description Resource Path Location Type&lt;BR /&gt;expected ';', ',' or ')' before string constant main.c /MKL26Z128xxx4_Project/source line 377 C/C++ Problem&lt;BR /&gt;expected ';', ',' or ')' before string constant main.c /MKL26Z128xxx4_Project/source line 378 C/C++ Problem&lt;BR /&gt;make: *** [source/main.o] Error 1 MKL26Z128xxx4_Project C/C++ Problem&lt;BR /&gt;recipe for target 'source/main.o' failed subdir.mk /MKL26Z128xxx4_Project/Debug/source line 18 C/C++ Problem&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Dec 2017 12:00:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-IDE/Basic-question-about-strcpy-with-MCUxpresso/m-p/739853#M1464</guid>
      <dc:creator>marianiordan</dc:creator>
      <dc:date>2017-12-21T12:00:14Z</dc:date>
    </item>
    <item>
      <title>Re: Basic question about strcpy with MCUxpresso:</title>
      <link>https://community.nxp.com/t5/MCUXpresso-IDE/Basic-question-about-strcpy-with-MCUxpresso/m-p/739854#M1465</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;why you write char befor LCD_TXT[0] in the strcpy statement?&lt;/P&gt;&lt;P&gt;try this: strcpy(LCD_TXT[0], (char*) "def"); or this: strcpy(LCD_TXT[0], "def"); both of them showld works.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Dec 2017 15:29:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-IDE/Basic-question-about-strcpy-with-MCUxpresso/m-p/739854#M1465</guid>
      <dc:creator>hanisamara</dc:creator>
      <dc:date>2017-12-21T15:29:06Z</dc:date>
    </item>
    <item>
      <title>Re: Basic question about strcpy with MCUxpresso:</title>
      <link>https://community.nxp.com/t5/MCUXpresso-IDE/Basic-question-about-strcpy-with-MCUxpresso/m-p/739855#M1466</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hani,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks for&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;taking the time&lt;/SPAN&gt;&lt;SPAN&gt;. if I don't do char before destination, it complains about it missing (see below).&amp;nbsp;&lt;/SPAN&gt;I tried&amp;nbsp;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;&lt;SPAN style="color: #0000ff;"&gt;strcpy(LCD_TXT[0], "def")&lt;/SPAN&gt;&amp;nbsp;in&amp;nbsp;a different environment (both Arduino gcc and Qt) - everything is fine. however&amp;nbsp;in MCUxpresso I get the error above; below you have the errors for both suggestions you mentioned:&lt;/SPAN&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;376:&amp;nbsp; &amp;nbsp; char LCD_TXT[2][21];&lt;BR /&gt;377:&amp;nbsp; &amp;nbsp; strcpy(LCD_TXT[0], (char*) "def");&lt;BR /&gt;378:&amp;nbsp; &amp;nbsp; strcpy(LCD_TXT[1], "tuv");&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;expected declaration specifiers or '...' before '(' token main.c /MKL26Z128xxx4_Project/source line 377 C/C++ Problem&lt;BR /&gt;expected declaration specifiers or '...' before 'LCD_TXT' main.c /MKL26Z128xxx4_Project/source line 377 C/C++ Problem&lt;BR /&gt;expected declaration specifiers or '...' before 'LCD_TXT' main.c /MKL26Z128xxx4_Project/source line 378 C/C++ Problem&lt;BR /&gt;expected declaration specifiers or '...' before string constant main.c /MKL26Z128xxx4_Project/source line 378 C/C++ Problem&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Dec 2017 21:45:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-IDE/Basic-question-about-strcpy-with-MCUxpresso/m-p/739855#M1466</guid>
      <dc:creator>marianiordan</dc:creator>
      <dc:date>2017-12-21T21:45:51Z</dc:date>
    </item>
    <item>
      <title>Re: Basic question about strcpy with MCUxpresso:</title>
      <link>https://community.nxp.com/t5/MCUXpresso-IDE/Basic-question-about-strcpy-with-MCUxpresso/m-p/739856#M1467</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Looks like it is more likely to be how strcpy is defined. How have you defined strcpy? Have you #include &amp;lt;string.h&amp;gt;?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As an example, this snippet compiles perfectly:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="color: #3933ff; font-size: 11px;"&gt;&lt;SPAN style="color: #931a68;"&gt;#include&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt; &lt;/SPAN&gt;&amp;lt;string.h&amp;gt;&lt;/P&gt;&lt;P style="font-size: 11px;"&gt;&lt;/P&gt;&lt;P style="font-size: 11px;"&gt;&lt;SPAN style="color: #931a68;"&gt;void&lt;/SPAN&gt; test() {&lt;/P&gt;&lt;P style="font-size: 11px;"&gt;&lt;SPAN class=""&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #931a68;"&gt;char&lt;/SPAN&gt; LCD_TXT[2][21];&lt;/P&gt;&lt;P style="font-size: 11px;"&gt;&lt;SPAN class=""&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #793d93;"&gt;strcpy&lt;/SPAN&gt;( LCD_TXT[0],&amp;nbsp; &lt;SPAN style="color: #3933ff;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #3933ff; text-decoration: underline;"&gt;def&lt;/SPAN&gt;&lt;SPAN style="color: #3933ff;"&gt;"&lt;/SPAN&gt;);&lt;/P&gt;&lt;P style="font-size: 11px;"&gt;&lt;SPAN class=""&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #793d93;"&gt;strcpy&lt;/SPAN&gt;( LCD_TXT[1],&amp;nbsp; &lt;SPAN style="color: #3933ff;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #3933ff; text-decoration: underline;"&gt;tuv&lt;/SPAN&gt;&lt;SPAN style="color: #3933ff;"&gt;"&lt;/SPAN&gt;);&lt;/P&gt;&lt;P style="font-size: 11px;"&gt;}&lt;/P&gt;&lt;P style="font-size: 11px;"&gt;&lt;/P&gt;&lt;P style="font-size: 11px;"&gt;&lt;/P&gt;&lt;P&gt;Compare this with your failing example, and see if you can fix it. If not, post a compilable example that reproduces your problem.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Dec 2017 09:29:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-IDE/Basic-question-about-strcpy-with-MCUxpresso/m-p/739856#M1467</guid>
      <dc:creator>converse</dc:creator>
      <dc:date>2017-12-22T09:29:09Z</dc:date>
    </item>
    <item>
      <title>Re: Basic question about strcpy with MCUxpresso:</title>
      <link>https://community.nxp.com/t5/MCUXpresso-IDE/Basic-question-about-strcpy-with-MCUxpresso/m-p/739857#M1468</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks to all that took their time to read and answer (especially Con Verse for putting the code in the context). The problem&amp;nbsp;I had was trying to use the code outside any function's body, just below global declarations. Now it works as expected.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399;"&gt;int initLCD(void) {&lt;/SPAN&gt;&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;char LCD_TXT[2][21];&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;strcpy(LCD_TXT[0], "abc");&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;strcpy(LCD_TXT[1], "tuv");&lt;BR /&gt;&lt;SPAN style="color: #000080;"&gt;return 0;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #000080;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Dec 2017 18:42:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-IDE/Basic-question-about-strcpy-with-MCUxpresso/m-p/739857#M1468</guid>
      <dc:creator>marianiordan</dc:creator>
      <dc:date>2017-12-22T18:42:47Z</dc:date>
    </item>
  </channel>
</rss>

