<?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>8-bit MicrocontrollersのトピックRe: Linker Error</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Linker-Error-MC90S08QE/m-p/210893#M18082</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Basically what I was wanting to do is have a periodic interrupt, when it is triggered, it sets a variable. In the main loop, it watches that variable and when it sees that it has been set transmits the spi packet and resets the variable.&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 09 Apr 2008 03:00:07 GMT</pubDate>
    <dc:creator>OZ1</dc:creator>
    <dc:date>2008-04-09T03:00:07Z</dc:date>
    <item>
      <title>Linker Error - MC90S08QE</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Linker-Error-MC90S08QE/m-p/210888#M18077</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;SPAN&gt;I am new to using Codewarrior and have been more than slightly annoyed at my present problem.&amp;nbsp; I am using processor expert with MC90S08QE setup and have created a header file that will hold variables to be used in various parts of the program.&amp;nbsp; For right now, there is only one variable.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;unsigned char Send_SPI;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;this program will loop in the main method until a periodic timer event occurs, then it will send out an spi packet.&amp;nbsp; My problem is that when i use the #include in my main.c&amp;nbsp; as well as in my events.c file, I get the Linker error L1818 Send_SPI duplicated in main.c.o and events.c.o&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I guess my question is how do I just do a simple #include "myfile.h" and use the variable located in there without getting this linker error?&lt;/SPAN&gt;&lt;BR /&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Added p/n to subject.&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Message Edited by NLFSJ on &lt;/SPAN&gt;&lt;SPAN class="date_text"&gt;2008-04-08&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;SPAN class="time_text"&gt;04:34 PM&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Apr 2008 02:04:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Linker-Error-MC90S08QE/m-p/210888#M18077</guid>
      <dc:creator>OZ1</dc:creator>
      <dc:date>2008-04-09T02:04:33Z</dc:date>
    </item>
    <item>
      <title>Re: Linker Error</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Linker-Error-MC90S08QE/m-p/210889#M18078</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;The normal method for this is to not declare the variables in the header file but at the top of your source file. Then in your header file you put an extern declaration and place guards.&amp;nbsp; Your source file looks like:&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV class="msg_source_code"&gt;&lt;DIV class="text_smallest"&gt;Code:&lt;/DIV&gt;&lt;PRE&gt;#include "SPI.h"/* Variable Declarations */unsigned char Send_SPI;...&lt;/PRE&gt;&lt;/DIV&gt;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;Then your header file looks like:&lt;/DIV&gt;&lt;DIV class="msg_source_code"&gt;&lt;DIV class="text_smallest"&gt;Code:&lt;/DIV&gt;&lt;PRE&gt;#ifndef SPI_HEADER  // Header guard#define SPI_HEADER...extern unsigned char Send_SPI;....#endif&lt;/PRE&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;You can then include the header file&amp;nbsp;where ever needed.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;There is more than one way to do this and I have seen variables placed in the header file and to only include them if the source file calling it.&amp;nbsp; Something like this, the source file looking like:&lt;/DIV&gt;&lt;DIV class="msg_source_code"&gt;&lt;DIV class="text_smallest"&gt;Code:&lt;/DIV&gt;&lt;PRE&gt;#define SPI_SOURCE#include "SPI.h"....&lt;/PRE&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;&amp;nbsp;and header file:&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV class="msg_source_code"&gt;&lt;DIV class="text_smallest"&gt;Code:&lt;/DIV&gt;&lt;PRE&gt;#ifndef SPI_HEADER   #define SPI_HEADER.....#ifdef SPI_SOURCE// Source declarations here   unsigned char Send_SPI;   ...#else// External declarations here   extern unsigned char Send_SPI;#endif#endif&lt;/PRE&gt;&lt;/DIV&gt;&lt;BR /&gt;I would not suggest doing it this way though.&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Apr 2008 02:30:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Linker-Error-MC90S08QE/m-p/210889#M18078</guid>
      <dc:creator>allawtterb</dc:creator>
      <dc:date>2008-04-09T02:30:37Z</dc:date>
    </item>
    <item>
      <title>Re: Linker Error</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Linker-Error-MC90S08QE/m-p/210890#M18079</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Thank you for the response.&amp;nbsp; What is the reasoning for having to do it this way?&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I have used Atmel microcontrollers in the past and have typically just been able to use a standard #include and have access to the variables there.&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Apr 2008 02:36:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Linker-Error-MC90S08QE/m-p/210890#M18079</guid>
      <dc:creator>OZ1</dc:creator>
      <dc:date>2008-04-09T02:36:37Z</dc:date>
    </item>
    <item>
      <title>Re: Linker Error</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Linker-Error-MC90S08QE/m-p/210891#M18080</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;I will tell you this, it has nothing to do with CW, this is what any other (except perhaps the one you have been using) "C" compiler would do.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Apr 2008 02:48:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Linker-Error-MC90S08QE/m-p/210891#M18080</guid>
      <dc:creator>JeffS_</dc:creator>
      <dc:date>2008-04-09T02:48:37Z</dc:date>
    </item>
    <item>
      <title>Re: Linker Error</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Linker-Error-MC90S08QE/m-p/210892#M18081</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;He is correct that this has nothing to do with CW. What has been describes would cause a link error in most "C" systems, as you have doubly defined it.&lt;BR /&gt;&lt;BR /&gt;Perhaps the reason you are doing this has to do with PE and the regeneration of the code.&lt;BR /&gt;You should not define things in the files generated by PE, as they could get lost later.&lt;BR /&gt;If you are using PE generated code, normally you pass in variables, and other variables you need can be defined in files you create. Look at the API that PE has generated and see if this is not the case - that it is un-necessary to define a variable in the PE generated code. Both the .f file and the.c file will document the APi.&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Apr 2008 02:55:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Linker-Error-MC90S08QE/m-p/210892#M18081</guid>
      <dc:creator>JimDon</dc:creator>
      <dc:date>2008-04-09T02:55:52Z</dc:date>
    </item>
    <item>
      <title>Re: Linker Error</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Linker-Error-MC90S08QE/m-p/210893#M18082</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Basically what I was wanting to do is have a periodic interrupt, when it is triggered, it sets a variable. In the main loop, it watches that variable and when it sees that it has been set transmits the spi packet and resets the variable.&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Apr 2008 03:00:07 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Linker-Error-MC90S08QE/m-p/210893#M18082</guid>
      <dc:creator>OZ1</dc:creator>
      <dc:date>2008-04-09T03:00:07Z</dc:date>
    </item>
    <item>
      <title>Re: Linker Error</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Linker-Error-MC90S08QE/m-p/210894#M18083</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;This could be the case for a GCC based compiler (are you using WinAVR?).&amp;nbsp;&amp;nbsp;It&amp;nbsp;appears that&amp;nbsp;GCC by default places uninitialized variables in the common block which allows for&amp;nbsp;multiple definitions.&amp;nbsp;&amp;nbsp; To place the variable in the data block instead and force initialization you must use the nocommon attribute.&amp;nbsp; To force the nocommon attribute for all definitions use the -fno-common compiler option.&amp;nbsp; Note that this will cause a variable to be intialized to zero.&amp;nbsp; &amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Apr 2008 04:13:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Linker-Error-MC90S08QE/m-p/210894#M18083</guid>
      <dc:creator>allawtterb</dc:creator>
      <dc:date>2008-04-09T04:13:46Z</dc:date>
    </item>
    <item>
      <title>Re: Linker Error</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Linker-Error-MC90S08QE/m-p/210895#M18084</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;Yes, it was avr studios with Winavr.&amp;nbsp; Thanks for clarifying the difference between the two ways of doing it.&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;Message Edited by OZ1 on &lt;SPAN class="date_text"&gt;2008-04-08&lt;/SPAN&gt; &lt;SPAN class="time_text"&gt;10:20 PM&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Apr 2008 04:19:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Linker-Error-MC90S08QE/m-p/210895#M18084</guid>
      <dc:creator>OZ1</dc:creator>
      <dc:date>2008-04-09T04:19:09Z</dc:date>
    </item>
    <item>
      <title>Re: Linker Error</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Linker-Error-MC90S08QE/m-p/210896#M18085</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;&lt;BLOCKQUOTE&gt;&lt;DIV&gt;&lt;HR /&gt;OZ1 wrote:&lt;BR /&gt;Basically what I was wanting to do is have a periodic interrupt, when it is triggered, it sets a variable. In the main loop, it watches that variable and when it sees that it has been set transmits the spi packet and resets the variable.&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;You can include headers in PE generated files.&amp;nbsp; The problem is that if they get regenerated by PE the headers you included will have to be added again.&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Apr 2008 04:44:11 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Linker-Error-MC90S08QE/m-p/210896#M18085</guid>
      <dc:creator>allawtterb</dc:creator>
      <dc:date>2008-04-09T04:44:11Z</dc:date>
    </item>
    <item>
      <title>Re: Linker Error</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Linker-Error-MC90S08QE/m-p/210897#M18086</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;I have been looking through the Standard settings, where do I find the -fno-common compiler option?&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Apr 2008 06:30:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Linker-Error-MC90S08QE/m-p/210897#M18086</guid>
      <dc:creator>OZ1</dc:creator>
      <dc:date>2008-04-09T06:30:25Z</dc:date>
    </item>
    <item>
      <title>Re: Linker Error</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Linker-Error-MC90S08QE/m-p/210898#M18087</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;It's not a CodeWarrior option, it is a gcc option to behave like CW when I understand this right.&lt;BR /&gt;You can suppress the L1818 message in the linker message dialog, but instead I would suggest to only declare variables in the header file (with extern) and define them explicitly in a *.c file (or use some macro magic to behave as if you would have done this).&lt;BR /&gt;&lt;BR /&gt;Daniel&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Apr 2008 09:28:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Linker-Error-MC90S08QE/m-p/210898#M18087</guid>
      <dc:creator>CompilerGuru</dc:creator>
      <dc:date>2008-04-09T09:28:38Z</dc:date>
    </item>
    <item>
      <title>Re: Linker Error - MC90S08QE</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Linker-Error-MC90S08QE/m-p/210899#M18088</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Thanks for the tips everybody.&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Apr 2008 19:36:45 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Linker-Error-MC90S08QE/m-p/210899#M18088</guid>
      <dc:creator>OZ1</dc:creator>
      <dc:date>2008-04-09T19:36:45Z</dc:date>
    </item>
  </channel>
</rss>

