<?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: undefined reference to `main' in MCUXpresso IDE</title>
    <link>https://community.nxp.com/t5/MCUXpresso-IDE/undefined-reference-to-main/m-p/1265032#M6891</link>
    <description>&lt;P&gt;It all depends how you have 'migrated' your projects.&lt;/P&gt;&lt;P&gt;Keep in mind that the project nature needs to match your settings, see &lt;A href="https://mcuoneclipse.com/2020/07/11/from-c-to-c-converting-eclipse-c-projekts/" target="_blank"&gt;https://mcuoneclipse.com/2020/07/11/from-c-to-c-converting-eclipse-c-projekts/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;On top of that, it all depends how you organize your calling conventions: keep in mind that main is a special symbol, plus for calling interfaces implemented in C from C++ you need to add an 'extern "C"' to manage the name mangling.&lt;/P&gt;&lt;P&gt;And don't forget the thing about the global constructor calls.&lt;/P&gt;&lt;P&gt;I hope this helps,&lt;/P&gt;&lt;P&gt;Erich&lt;/P&gt;</description>
    <pubDate>Tue, 20 Apr 2021 09:26:19 GMT</pubDate>
    <dc:creator>ErichStyger</dc:creator>
    <dc:date>2021-04-20T09:26:19Z</dc:date>
    <item>
      <title>undefined reference to `main'</title>
      <link>https://community.nxp.com/t5/MCUXpresso-IDE/undefined-reference-to-main/m-p/1265001#M6890</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am currently working with the frdm K22F SDK, more precisley the dspi_half_duplex_int_master. This is a C Project and I want to integrate C++ files into it. To execute it, I decided to change the main file from .c to .cpp which leads to the following error when building it.&lt;/P&gt;&lt;P&gt;make -r -j8 all&lt;BR /&gt;Building target: frdmk22f_dspi_half_duplex_int_master.axf&lt;BR /&gt;Invoking: MCU Linker&lt;BR /&gt;arm-none-eabi-gcc -nostdlib -Xlinker -Map="frdmk22f_dspi_half_duplex_int_master.map" -Xlinker --gc-sections -Xlinker -print-memory-usage -Xlinker --sort-section=alignment -Xlinker --cref -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -T frdmk22f_dspi_half_duplex_int_master_Debug.ld -o "frdmk22f_dspi_half_duplex_int_master.axf" ./utilities/fsl_assert.o ./utilities/fsl_debug_console.o ./startup/startup_mk22f51212.o ./source/semihost_hardfault.o ./drivers/fsl_clock.o ./drivers/fsl_common.o ./drivers/fsl_dspi.o ./drivers/fsl_gpio.o ./drivers/fsl_lpuart.o ./drivers/fsl_smc.o ./drivers/fsl_uart.o ./device/system_MK22F51212.o ./component/uart/fsl_adapter_uart.o ./component/lists/fsl_component_generic_list.o ./board/board.o ./board/clock_config.o ./board/pin_mux.o&lt;BR /&gt;Memory region Used Size Region Size %age Used&lt;BR /&gt;PROGRAM_FLASH: 7912 B 512 KB 1.51%&lt;BR /&gt;c:/nxp/mcuxpressoide_11.3.0_5222/ide/plugins/com.nxp.mcuxpresso.tools.win32_11.3.0.202008311133/tools/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld.exe: c:/nxp/mcuxpressoide_11.3.0_5222/ide/plugins/com.nxp.mcuxpresso.tools.win32_11.3.0.202008311133/tools/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/lib/thumb/v7e-m+fp/hard\libcr_semihost_nf.a(_cr__main.o): in function `__main':&lt;BR /&gt;SRAM_UPPER: 8424 B 64 KB 12.85%&lt;BR /&gt;_cr__main.c:(.text.__main+0xa): undefined reference to `main'&lt;BR /&gt;collect2.exe: error: ld returned 1 exit status&lt;BR /&gt;SRAM_LOWER: 0 GB 64 KB 0.00%&lt;BR /&gt;make: *** [makefile:39: frdmk22f_dspi_half_duplex_int_master.axf] Error 1&lt;BR /&gt;"make -r -j8 all" terminated with exit code 2. Build might be incomplete.&lt;/P&gt;&lt;P&gt;From these posts:&amp;nbsp;&lt;A href="https://community.nxp.com/t5/MCUXpresso-IDE/undefined-reference/m-p/792802/page/2" target="_self"&gt;here&lt;/A&gt;&amp;nbsp;and&amp;nbsp;&lt;A href="https://community.nxp.com/t5/LPCXpresso-IDE-FAQs/Linker-error-quot-Undefined-reference-to-xxx-quot/m-p/472216" target="_self"&gt;here&lt;/A&gt;&amp;nbsp;it seems to me that I need to change something with the linker files. But I don't know for sure if that is the same problem.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;What causes the error?&lt;/LI&gt;&lt;LI&gt;If it is related to the linker files, what do I need to change and how?&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Thanks in advance!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Apr 2021 09:04:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-IDE/undefined-reference-to-main/m-p/1265001#M6890</guid>
      <dc:creator>CK3</dc:creator>
      <dc:date>2021-04-20T09:04:39Z</dc:date>
    </item>
    <item>
      <title>Re: undefined reference to `main'</title>
      <link>https://community.nxp.com/t5/MCUXpresso-IDE/undefined-reference-to-main/m-p/1265032#M6891</link>
      <description>&lt;P&gt;It all depends how you have 'migrated' your projects.&lt;/P&gt;&lt;P&gt;Keep in mind that the project nature needs to match your settings, see &lt;A href="https://mcuoneclipse.com/2020/07/11/from-c-to-c-converting-eclipse-c-projekts/" target="_blank"&gt;https://mcuoneclipse.com/2020/07/11/from-c-to-c-converting-eclipse-c-projekts/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;On top of that, it all depends how you organize your calling conventions: keep in mind that main is a special symbol, plus for calling interfaces implemented in C from C++ you need to add an 'extern "C"' to manage the name mangling.&lt;/P&gt;&lt;P&gt;And don't forget the thing about the global constructor calls.&lt;/P&gt;&lt;P&gt;I hope this helps,&lt;/P&gt;&lt;P&gt;Erich&lt;/P&gt;</description>
      <pubDate>Tue, 20 Apr 2021 09:26:19 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-IDE/undefined-reference-to-main/m-p/1265032#M6891</guid>
      <dc:creator>ErichStyger</dc:creator>
      <dc:date>2021-04-20T09:26:19Z</dc:date>
    </item>
    <item>
      <title>Re: undefined reference to `main'</title>
      <link>https://community.nxp.com/t5/MCUXpresso-IDE/undefined-reference-to-main/m-p/1265061#M6893</link>
      <description>&lt;P&gt;Hi Erich,&lt;/P&gt;&lt;P&gt;thanks for the quick reply. Yes it helped! I followed the steps from the link you posted and also verified for the global constructor calls. I still had some errors but they disappeared after I changed the lib from NewlibNano(none) to NewlibNano(nohost). So everything builds now fine.&lt;/P&gt;&lt;P&gt;However, now I don't get any output in the console now, that I got before (like "Hello World"). Do you have any idea what could cause this?&lt;/P&gt;</description>
      <pubDate>Tue, 20 Apr 2021 10:10:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-IDE/undefined-reference-to-main/m-p/1265061#M6893</guid>
      <dc:creator>CK3</dc:creator>
      <dc:date>2021-04-20T10:10:32Z</dc:date>
    </item>
    <item>
      <title>Re: undefined reference to `main'</title>
      <link>https://community.nxp.com/t5/MCUXpresso-IDE/undefined-reference-to-main/m-p/1265069#M6894</link>
      <description>&lt;P&gt;Thanks for the quick help! Do you know a solution regarding the console-output problem I now have? (see the wrongly placed reply by me)&lt;/P&gt;</description>
      <pubDate>Tue, 20 Apr 2021 10:25:17 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-IDE/undefined-reference-to-main/m-p/1265069#M6894</guid>
      <dc:creator>CK3</dc:creator>
      <dc:date>2021-04-20T10:25:17Z</dc:date>
    </item>
    <item>
      <title>Re: undefined reference to `main'</title>
      <link>https://community.nxp.com/t5/MCUXpresso-IDE/undefined-reference-to-main/m-p/1265074#M6895</link>
      <description>&lt;P&gt;Ok, I found that the problem was that I was using the nohost library variant. I swithed to semihost and now it works.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Apr 2021 10:37:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-IDE/undefined-reference-to-main/m-p/1265074#M6895</guid>
      <dc:creator>CK3</dc:creator>
      <dc:date>2021-04-20T10:37:32Z</dc:date>
    </item>
  </channel>
</rss>

