<?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: getting linker error message &amp;quot;multiple definition of `errno'&amp;quot; in MCUXpresso IDE</title>
    <link>https://community.nxp.com/t5/MCUXpresso-IDE/getting-linker-error-message-quot-multiple-definition-of-errno/m-p/1399540#M7717</link>
    <description>&lt;P&gt;I created a new ANSI-C Hello World MinGW (non-LPC) project and added a variable named errno. It compiles fine with MCUXpresso 11.3.1 but with 11.4.1 compilation fails with "error: expected declaration specifiers or '...' before '*' token". This most likely is because errno was defined as *__errno() in that errno.h before. Code:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;/*
 ============================================================================
 Name        : bla.c
 Author      : 
 Version     :
 Copyright   : Your copyright notice
 Description : Hello World in C, Ansi-style
 ============================================================================
 */

#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;stdlib.h&amp;gt;

uint8_t errno = 17;

int main(void) {
	while (errno)
	{
		if (errno &amp;gt; 10)
			errno -=2;
		else
			errno--;
	}
	puts("!!!Hello World!!!"); /* prints !!!Hello World!!! */
	return EXIT_SUCCESS;
}&lt;/LI-CODE&gt;&lt;P&gt;I uninstalled and repeated the process of creating and trying to build that tiny project: same compiler error.&lt;/P&gt;&lt;P&gt;I installed Version 1.4.0 and repeated: same compiler error.&lt;/P&gt;&lt;P&gt;So I &lt;EM&gt;think&lt;/EM&gt; lwIP configuration is not the problem here. - But why hasn't anyone else stumbled across this?&lt;/P&gt;</description>
    <pubDate>Fri, 14 Jan 2022 15:44:05 GMT</pubDate>
    <dc:creator>Garry_Hoberg</dc:creator>
    <dc:date>2022-01-14T15:44:05Z</dc:date>
    <item>
      <title>getting linker error message "multiple definition of `errno'"</title>
      <link>https://community.nxp.com/t5/MCUXpresso-IDE/getting-linker-error-message-quot-multiple-definition-of-errno/m-p/1399467#M7715</link>
      <description>&lt;P&gt;Hello.&lt;/P&gt;&lt;P&gt;I just installed MCUXpresso 11.4.1 and tried to compile a project. That failed with the linker complaining:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;c:/nxp/mcuxpressoide_11.4.1_6260/ide/plugins/com.nxp.mcuxpresso.tools.win32_11.4.0.202103011116/tools/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld.exe: c:/nxp/mcuxpressoide_11.4.1_6260/ide/plugins/com.nxp.mcuxpresso.tools.win32_11.4.0.202103011116/tools/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/lib/thumb/v7e-m+fp/hard\libc_nano.a(lib_a-reent.o):(.bss.errno+0x0): multiple definition of `errno'; &amp;lt;added line break for readability&amp;gt;
./lpcxpresso54628/middleware/lwip/port/sys_arch.o:C:\Users\&amp;lt;user name&amp;gt;\&amp;lt;project path&amp;gt;\Debug/../lpcxpresso54628/middleware/lwip/port/sys_arch.c:64: first defined here&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried the IDE C/C++ search function and the only file outside the SDK that defines errno is C:/nxp/MCUXpressoIDE_11.4.1_6260/ide/plugins/com.nxp.mcuxpresso.tools.win32_11.4.0.202103011116/tools/arm-none-eabi/include/sys/errno.h - That's within the IDE install path... the IDE should be well aware of this and handle it.&lt;/P&gt;&lt;P&gt;While MCUXpresso 11.3.1 does find that definition in the errno.h in the 11.3.1 install path it manages to build the same project without complaints.&lt;/P&gt;&lt;P&gt;Has anyone come across this before?&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jan 2022 12:41:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-IDE/getting-linker-error-message-quot-multiple-definition-of-errno/m-p/1399467#M7715</guid>
      <dc:creator>Garry_Hoberg</dc:creator>
      <dc:date>2022-01-14T12:41:48Z</dc:date>
    </item>
    <item>
      <title>Re: getting linker error message "multiple definition of `errno'"</title>
      <link>https://community.nxp.com/t5/MCUXpresso-IDE/getting-linker-error-message-quot-multiple-definition-of-errno/m-p/1399537#M7716</link>
      <description>&lt;P&gt;The linker complains about multiple definitions. Multiple declarations in header files are ok.&lt;/P&gt;&lt;P&gt;So older linker might just have ignored it or put a warning for it.&lt;/P&gt;&lt;P&gt;In your case you have one definition in newlib-nano (which you won't be able to easily change, and anyway that's the one which counts), and another one in your lwip: I would check the later one and remove it if necessary (unless you have mis-configured lwip and it thinks it needs to add yet another errno).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope this helps,&lt;/P&gt;&lt;P&gt;Erich&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jan 2022 15:37:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-IDE/getting-linker-error-message-quot-multiple-definition-of-errno/m-p/1399537#M7716</guid>
      <dc:creator>ErichStyger</dc:creator>
      <dc:date>2022-01-14T15:37:44Z</dc:date>
    </item>
    <item>
      <title>Re: getting linker error message "multiple definition of `errno'"</title>
      <link>https://community.nxp.com/t5/MCUXpresso-IDE/getting-linker-error-message-quot-multiple-definition-of-errno/m-p/1399540#M7717</link>
      <description>&lt;P&gt;I created a new ANSI-C Hello World MinGW (non-LPC) project and added a variable named errno. It compiles fine with MCUXpresso 11.3.1 but with 11.4.1 compilation fails with "error: expected declaration specifiers or '...' before '*' token". This most likely is because errno was defined as *__errno() in that errno.h before. Code:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;/*
 ============================================================================
 Name        : bla.c
 Author      : 
 Version     :
 Copyright   : Your copyright notice
 Description : Hello World in C, Ansi-style
 ============================================================================
 */

#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;stdlib.h&amp;gt;

uint8_t errno = 17;

int main(void) {
	while (errno)
	{
		if (errno &amp;gt; 10)
			errno -=2;
		else
			errno--;
	}
	puts("!!!Hello World!!!"); /* prints !!!Hello World!!! */
	return EXIT_SUCCESS;
}&lt;/LI-CODE&gt;&lt;P&gt;I uninstalled and repeated the process of creating and trying to build that tiny project: same compiler error.&lt;/P&gt;&lt;P&gt;I installed Version 1.4.0 and repeated: same compiler error.&lt;/P&gt;&lt;P&gt;So I &lt;EM&gt;think&lt;/EM&gt; lwIP configuration is not the problem here. - But why hasn't anyone else stumbled across this?&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jan 2022 15:44:05 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-IDE/getting-linker-error-message-quot-multiple-definition-of-errno/m-p/1399540#M7717</guid>
      <dc:creator>Garry_Hoberg</dc:creator>
      <dc:date>2022-01-14T15:44:05Z</dc:date>
    </item>
    <item>
      <title>Re: getting linker error message "multiple definition of `errno'"</title>
      <link>https://community.nxp.com/t5/MCUXpresso-IDE/getting-linker-error-message-quot-multiple-definition-of-errno/m-p/1399586#M7718</link>
      <description>&lt;P&gt;probably unrelated:&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;I created a new ANSI-C Hello World &lt;STRONG&gt;MinGW&lt;/STRONG&gt; (non-LPC) project&lt;/P&gt;&lt;P&gt;I'm wondering why MinGW is involved here? Comparing MinGW projects with GNU ARM Embedded is something completely different (libraries, headers, etc).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyway, you have to check your project (and settings). In my lwip there is&lt;/P&gt;&lt;P&gt;#ifndef errno&lt;BR /&gt;int errno = 0;&lt;BR /&gt;#endif&lt;/P&gt;&lt;P&gt;So it really depends if errno is defined somewhere or not: this can be with many reasons, and can be with subtle library header changes or changed include orders. Keep in mind that every IDE comes with a different version of the GNU ARM Embedded Toolchain and version, so it could be that there is a change there.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Erich&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jan 2022 17:32:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-IDE/getting-linker-error-message-quot-multiple-definition-of-errno/m-p/1399586#M7718</guid>
      <dc:creator>ErichStyger</dc:creator>
      <dc:date>2022-01-14T17:32:03Z</dc:date>
    </item>
    <item>
      <title>Re: getting linker error message "multiple definition of `errno'"</title>
      <link>https://community.nxp.com/t5/MCUXpresso-IDE/getting-linker-error-message-quot-multiple-definition-of-errno/m-p/1401036#M7732</link>
      <description>&lt;P&gt;&amp;gt;&amp;gt;probably unrelated:&lt;/P&gt;&lt;P&gt;Yes! I was confused.&lt;/P&gt;&lt;P&gt;Experimented a lot. Compared config files to a similar project that works with V. 11.4.1 (same controller, RTOS, same lwIP settings, several shared files). - As soon as I set #define configUSE_NEWLIB_REENTRANT to 0 (FreeRTOSConfig.h) it all compiled fine.&lt;/P&gt;&lt;P&gt;I had assumed that reentrant functions are the way to go when using an RTOS. But since LWIP_TCPIP_CORE_LOCKING is 1 as well as&amp;nbsp;SYS_LIGHTWEIGHT_PROT and Threads all have unique jobs to do and hardly share any ressources besides CPU this may actually work. - Still feels somewhat counter-intuitive...&lt;/P&gt;&lt;P&gt;I'll mark this as solution since you pointed me to check the (lwIP) configuration.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jan 2022 15:51:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-IDE/getting-linker-error-message-quot-multiple-definition-of-errno/m-p/1401036#M7732</guid>
      <dc:creator>Garry_Hoberg</dc:creator>
      <dc:date>2022-01-18T15:51:29Z</dc:date>
    </item>
    <item>
      <title>Re: getting linker error message "multiple definition of `errno'"</title>
      <link>https://community.nxp.com/t5/MCUXpresso-IDE/getting-linker-error-message-quot-multiple-definition-of-errno/m-p/1605415#M8783</link>
      <description>&lt;P&gt;I ran into this same issue and would like to add that another solution is to add the '-z muldefs' option to the linker setting to allow for multiple definitions. This allows use of&amp;nbsp;&lt;SPAN&gt;#define configUSE_NEWLIB_REENTRANT 1.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Feb 2023 17:21:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-IDE/getting-linker-error-message-quot-multiple-definition-of-errno/m-p/1605415#M8783</guid>
      <dc:creator>lh_dan</dc:creator>
      <dc:date>2023-02-24T17:21:55Z</dc:date>
    </item>
  </channel>
</rss>

