<?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: Issues with using C libraries with C++ files in MCUXpresso IDE</title>
    <link>https://community.nxp.com/t5/MCUXpresso-IDE/Issues-with-using-C-libraries-with-C-files/m-p/1088300#M5959</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think to help any more, we are going to need to reproduce the issue. Can you provide an example that exhibits the same problem?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 11 Jun 2020 21:07:17 GMT</pubDate>
    <dc:creator>converse</dc:creator>
    <dc:date>2020-06-11T21:07:17Z</dc:date>
    <item>
      <title>Issues with using C libraries with C++ files</title>
      <link>https://community.nxp.com/t5/MCUXpresso-IDE/Issues-with-using-C-libraries-with-C-files/m-p/1088288#M5947</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am having an issue using C libraries in a C++ project and I'd appreciate any suggestions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a set of library files, all written in C, that I know works when being called from a C file&amp;nbsp;in my project.&amp;nbsp; The library is comprised of multiple sub libraries where each one has a single primary header file.&amp;nbsp; These primary header files link all of the libraries's files and contains numerous macros to change the library behavior depending on the preprocessor commands.&amp;nbsp; Additionally, one of these sub libraries could be considered the primary library since the other sub libraries use it for common functions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In my C++ files, I have included the C libraries using the "extern "C"" functionality and I can call/use the primary library without issue.&amp;nbsp; Additionally, I can use any of the other libraries provided that they, themselves, are not trying to use any of the functionality of the primary library.&amp;nbsp; When that happens, the compiler generates an "unrecongized reference" error where the library tries to call the primary library.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;C++ calls primary library function == OK&lt;/LI&gt;&lt;LI&gt;C++ calls a non-primary library function == OK&lt;/LI&gt;&lt;LI&gt;C++ calls a non-primary library function that calls a primary library function == unrecognized reference to primary library function&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have confirmed that all of the library header files utilize the&amp;nbsp;"__cplusplus" definition and all of the library files are either .c or .h.&amp;nbsp; (Although redundant, I also have all of the libraries included as "extern "C"".)&amp;nbsp; I have also confirmed that if I convert the C++ to a C equivalent and use the exact same library function calls, the project compiles.&amp;nbsp; (I commented out the library call in the C++ file and changed nothing else in the project.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does anyone have any suggestions on what to try?&amp;nbsp; I've spent several days trying to find the root cause of this and I'm pretty certain that the problem is the C++ compiler changing the C file references.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jun 2020 11:47:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-IDE/Issues-with-using-C-libraries-with-C-files/m-p/1088288#M5947</guid>
      <dc:creator>chadgraham</dc:creator>
      <dc:date>2020-06-11T11:47:03Z</dc:date>
    </item>
    <item>
      <title>Re: Issues with using C libraries with C++ files</title>
      <link>https://community.nxp.com/t5/MCUXpresso-IDE/Issues-with-using-C-libraries-with-C-files/m-p/1088289#M5948</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just for the common understanding:&lt;/P&gt;&lt;P&gt;The "__cplusplus" is for recognizing if the source file is compiled in C or in C++ mode (the file extension actually does not main anything, have a read at &lt;A class="link-titled" href="https://mcuoneclipse.com/2013/03/23/compiling-c-files-with-gnu-arm-g/" title="https://mcuoneclipse.com/2013/03/23/compiling-c-files-with-gnu-arm-g/"&gt;Compiling C Files with GNU ARM G++ | MCU on Eclipse&lt;/A&gt; .&lt;/P&gt;&lt;P&gt;The 'extern "C"' is for something different: is for the name mangling: either C or C++ (which includes the encoding of the parameters. So using 'extern "C"' is not something redundant, it is mandatory for having the name mangling set for calling C code from C++. Could it be that you have this wrong, or understood it a wrong way? Or that some of your library still uses C++ name mangling but you expect it to have it C name mangling?&lt;/P&gt;&lt;P&gt;You could check with the linker map file or use the GNU nm utility (&lt;A class="link-titled" href="https://mcuoneclipse.com/2018/04/02/listing-code-and-data-size-with-gnu-nm-in-eclipse/" title="https://mcuoneclipse.com/2018/04/02/listing-code-and-data-size-with-gnu-nm-in-eclipse/"&gt;Listing Code and Data Size with GNU nm in Eclipse | MCU on Eclipse&lt;/A&gt; ) to check the name encoding.&lt;/P&gt;&lt;P&gt;&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, 11 Jun 2020 12:33:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-IDE/Issues-with-using-C-libraries-with-C-files/m-p/1088289#M5948</guid>
      <dc:creator>ErichStyger</dc:creator>
      <dc:date>2020-06-11T12:33:26Z</dc:date>
    </item>
    <item>
      <title>Re: Issues with using C libraries with C++ files</title>
      <link>https://community.nxp.com/t5/MCUXpresso-IDE/Issues-with-using-C-libraries-with-C-files/m-p/1088290#M5949</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;"t&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;he file extension actually does not [mean] anything"&lt;BR /&gt;&lt;BR /&gt;Some versions of GCC will compile a file that ends with a capital 'C' (.C)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;with G++ and a small 'c' (.c) with GCC.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt; On Windows where the OS doesn't care and GCC/G++ does,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;it can lead to some head scratching quandaries as to what is going on.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;&lt;BR /&gt;Just to make the rest of the thread clear to others, this is what is being discussed:&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;#if defined(__cplusplus) &amp;amp;&amp;amp; __cplusplus&lt;BR /&gt;extern "C" {&lt;BR /&gt;#endif&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;/* C stuff goes here*/&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;#if defined(__cplusplus) &amp;amp;&amp;amp; __cplusplus&lt;BR /&gt;}&lt;BR /&gt;#endif&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jun 2020 12:55:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-IDE/Issues-with-using-C-libraries-with-C-files/m-p/1088290#M5949</guid>
      <dc:creator>bobpaddock</dc:creator>
      <dc:date>2020-06-11T12:55:16Z</dc:date>
    </item>
    <item>
      <title>Re: Issues with using C libraries with C++ files</title>
      <link>https://community.nxp.com/t5/MCUXpresso-IDE/Issues-with-using-C-libraries-with-C-files/m-p/1088291#M5950</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Pay particular attention to any leading underscores (_) in the maps that Erich points to.&lt;BR /&gt;Do they exist&amp;nbsp; or not and are of the same number (_) vs (__).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The compiler and linker can have different ideas about them at times,&lt;/P&gt;&lt;P&gt;across C and C++ code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This has often been a source of trouble for me when using various libraries with C++.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jun 2020 13:01:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-IDE/Issues-with-using-C-libraries-with-C-files/m-p/1088291#M5950</guid>
      <dc:creator>bobpaddock</dc:creator>
      <dc:date>2020-06-11T13:01:16Z</dc:date>
    </item>
    <item>
      <title>Re: Issues with using C libraries with C++ files</title>
      <link>https://community.nxp.com/t5/MCUXpresso-IDE/Issues-with-using-C-libraries-with-C-files/m-p/1088292#M5951</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello and thank you for the replies.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jx-jive-macro-user" href="https://community.nxp.com/people/ErichS"&gt;ErichS&lt;/A&gt;‌&lt;/P&gt;&lt;P&gt;I am following up on your suggestions, but I'm unable to find the .elf/.axf file; probable because I'm not able to complete the compile/link process.&amp;nbsp; Is there another way to access the symbol tool and see the links?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jx-jive-macro-user" href="https://community.nxp.com/people/bpaddock"&gt;bpaddock&lt;/A&gt;‌&lt;/P&gt;&lt;P&gt;All of the files are listed as .c and .cpp and the compile log lists the .c files using gcc tools.&amp;nbsp; The actual listings in the library headers are:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;STRONG&gt;#ifdef __cplusplus // Two Underscores&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;/* Yes, C++ compiler is present. Use standard C. */&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;extern "C" {&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;#endif&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;/* Library Header File */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;STRONG&gt;&amp;nbsp;/* Determine if a C++ compiler is being used. If so, complete the standard&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;C conditional started above. */&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;#ifdef __cplusplus&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;#endif&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;and the C++ file includes are:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;extern "C"&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#include "library1.h" // Primary Library&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;#include "&lt;/SPAN&gt;&lt;SPAN&gt;library2&lt;/SPAN&gt;&lt;SPAN&gt;.h" // Non-Primary Library&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jun 2020 13:15:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-IDE/Issues-with-using-C-libraries-with-C-files/m-p/1088292#M5951</guid>
      <dc:creator>chadgraham</dc:creator>
      <dc:date>2020-06-11T13:15:21Z</dc:date>
    </item>
    <item>
      <title>Re: Issues with using C libraries with C++ files</title>
      <link>https://community.nxp.com/t5/MCUXpresso-IDE/Issues-with-using-C-libraries-with-C-files/m-p/1088293#M5952</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Chad,&lt;/P&gt;&lt;P&gt;you can run the nm (&lt;CODE class=""&gt;arm-none-eabi-nm&amp;nbsp;-S&amp;nbsp;--size-sort&amp;nbsp;-s lib.a&lt;/CODE&gt;)&lt;/P&gt;&lt;P&gt;on the library (archive) too.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Erich&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jun 2020 13:48:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-IDE/Issues-with-using-C-libraries-with-C-files/m-p/1088293#M5952</guid>
      <dc:creator>ErichStyger</dc:creator>
      <dc:date>2020-06-11T13:48:58Z</dc:date>
    </item>
    <item>
      <title>Re: Issues with using C libraries with C++ files</title>
      <link>https://community.nxp.com/t5/MCUXpresso-IDE/Issues-with-using-C-libraries-with-C-files/m-p/1088294#M5953</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jx-jive-macro-user" href="https://community.nxp.com/people/ErichS"&gt;ErichS&lt;/A&gt;‌&lt;/P&gt;&lt;P&gt;I was able to track down the references in the library , but I must admit that I'm even more confused.&amp;nbsp; According to the -nm tool, the primary library contains the proper function call and file name and the non-primary library is calling the same function name.&amp;nbsp; (Verified with with the image view tool.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So... it looks like it is not a name mangle issue?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;From image view tool of the Non-Primary Library:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; _non-primary_library_called_function -&amp;gt; _non-primary_library_error_function -&amp;gt; _primary_library_function&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;From the NM tool on Non-Primary Library:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; _non-primary_library_error_function in&amp;nbsp;&lt;SPAN&gt;non-primary_library_error_function.o&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; // Lines later&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;non-primary_library_error_function.o:&amp;nbsp;00000000 00000032 T _non-primary_library_error_function&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;From the NM tool on Primary Library:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; _&lt;SPAN&gt;primary_library_function&lt;/SPAN&gt; in &lt;SPAN&gt;primary_library_function&lt;/SPAN&gt;&lt;SPAN&gt;.o&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; // Lines later&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; primary_library_function.o:&amp;nbsp;00000000 00000130 T _primary_library_function&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jun 2020 15:42:11 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-IDE/Issues-with-using-C-libraries-with-C-files/m-p/1088294#M5953</guid>
      <dc:creator>chadgraham</dc:creator>
      <dc:date>2020-06-11T15:42:11Z</dc:date>
    </item>
    <item>
      <title>Re: Issues with using C libraries with C++ files</title>
      <link>https://community.nxp.com/t5/MCUXpresso-IDE/Issues-with-using-C-libraries-with-C-files/m-p/1088295#M5954</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I was referring to the underscores that are part of the function names that that compiler inserts,&lt;/P&gt;&lt;P&gt;not the ones in __cplusplus.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jun 2020 15:50:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-IDE/Issues-with-using-C-libraries-with-C-files/m-p/1088295#M5954</guid>
      <dc:creator>bobpaddock</dc:creator>
      <dc:date>2020-06-11T15:50:18Z</dc:date>
    </item>
    <item>
      <title>Re: Issues with using C libraries with C++ files</title>
      <link>https://community.nxp.com/t5/MCUXpresso-IDE/Issues-with-using-C-libraries-with-C-files/m-p/1088296#M5955</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ok, so it really looks like it is using the C name mangling in the library.&lt;/P&gt;&lt;P&gt;So what is the linker error about it? What function does it expect?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(and I assume you have marked your functions as 'extern' anyway).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Erich&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jun 2020 15:55:04 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-IDE/Issues-with-using-C-libraries-with-C-files/m-p/1088296#M5955</guid>
      <dc:creator>ErichStyger</dc:creator>
      <dc:date>2020-06-11T15:55:04Z</dc:date>
    </item>
    <item>
      <title>Re: Issues with using C libraries with C++ files</title>
      <link>https://community.nxp.com/t5/MCUXpresso-IDE/Issues-with-using-C-libraries-with-C-files/m-p/1088297#M5956</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A class="jx-jive-macro-user" href="https://community.nxp.com/people/ErichS"&gt;ErichS&lt;/A&gt;‌&lt;/P&gt;&lt;P&gt;Hopefully this doesn't confuse things too much, but let me convert to using the real names of the libraries and functions to better explain the linker complaint.&amp;nbsp; This is all specific to ThreadX by Microsoft.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In my C++ class header, I include the primary library (tx_api.h) and the non-primary library (ux_api.h):&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;extern "C"&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;{&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;#include "tx_api.h" // Included for other sections of the class that are working&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;#include "ux_api.h"&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt; }&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In my C++ class, I try to initialize the UX device.&amp;nbsp; (I replaced all of the typical references and pointer with forced constants to ensure that I was providing legit, known data.)&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;ux_system_initialize(( VOID *) 0x81B00000,&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x19000,&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;UX_NULL,&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;0);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the ux_api.h, the function name is converted based upon preprocessor, program specific definitions.&amp;nbsp; (Note, this file has the extern __cplusplus block around the entire file.)&amp;nbsp; This is also the location for the library's reference to tx_api.h&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;STRONG&gt;#define ux_system_initialize _ux_system_initialize&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;/* Include ThreadX API include file. */&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;#include "tx_api.h"&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The function _ux_system_initialize is found in ux_system_initialize.c and it is the only function in the file.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;#include "ux_api.h"&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;UINT _ux_system_initialize(VOID *regular_memory_pool_start, ULONG regular_memory_size, &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;VOID *cache_safe_memory_pool_start, ULONG cache_safe_memory_size)&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;/* Some Code */&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;/* Create the Mutex object used by USBX to control critical sections. */&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;status = _ux_utility_mutex_create(&amp;amp;_ux_system -&amp;gt; ux_system_mutex, "ux_system_mutex");&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;/* Little More Code */&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The function&amp;nbsp;_ux_utility_mutex_create is found in ux_utility_mutex_create.c and is the only function in the file.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;#include "ux_api.h"&lt;/STRONG&gt;&lt;BR /&gt;&amp;nbsp;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;UINT _ux_utility_mutex_create(TX_MUTEX *mutex, CHAR *mutex_name)&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;UINT status;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;/* Call ThreadX to create the Mutex object. */&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;status = tx_mutex_create(mutex, (CHAR *) mutex_name, TX_NO_INHERIT); &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;/* Some Code */&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is where the error is generated:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;../..\ux\Debug\libux.a(ux_utility_mutex_create.o): in function `_ux_utility_mutex_create':&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;undefined reference to `_txe_mutex_create'&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Located inside tx_api.h, &lt;SPAN&gt;the function name is converted based upon preprocessor, program specific definitions.&amp;nbsp; (Note, this file has the extern __cplusplus block around the entire file.)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;STRONG&gt;#define tx_mutex_create(m,n,i) _txe_mutex_create((m),(n),(i),(sizeof(TX_MUTEX)))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The function&amp;nbsp;_txe_mutex_create is located in file&amp;nbsp;txe_mutex_create.c and is the only function in the file&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;#include "tx_api.h"&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;UINT _txe_mutex_create(TX_MUTEX *mutex_ptr, CHAR *name_ptr, UINT inherit, UINT &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;mutex_control_block_size)&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;/* Some Code */&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Per my previous post, the library for TX properly shows the _txe_mutex_create function and the preprocessors commands are all defaulted and pointing to the correct macros.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jun 2020 16:51:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-IDE/Issues-with-using-C-libraries-with-C-files/m-p/1088297#M5956</guid>
      <dc:creator>chadgraham</dc:creator>
      <dc:date>2020-06-11T16:51:03Z</dc:date>
    </item>
    <item>
      <title>Re: Issues with using C libraries with C++ files</title>
      <link>https://community.nxp.com/t5/MCUXpresso-IDE/Issues-with-using-C-libraries-with-C-files/m-p/1088298#M5957</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Check the ordering of your libraries if a function in library A calls a function in library B, then the ordering must be A B.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, in you example, is txe_mutual_create.c being built and included in the linker?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Finally, you mention&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;this file has the extern __cplusplus block around the entire file.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;can you clarify EXACTLY, what you are doing here. You need to use extern “C” Not extern __cplusplus. Take a look at this&amp;nbsp;&lt;A class="link-titled" href="https://embeddedartistry.com/blog/2017/05/01/mixing-c-and-c-extern-c/" title="https://embeddedartistry.com/blog/2017/05/01/mixing-c-and-c-extern-c/"&gt;Mixing C and C++: extern C - Embedded Artistry&lt;/A&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jun 2020 17:53:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-IDE/Issues-with-using-C-libraries-with-C-files/m-p/1088298#M5957</guid>
      <dc:creator>converse</dc:creator>
      <dc:date>2020-06-11T17:53:55Z</dc:date>
    </item>
    <item>
      <title>Re: Issues with using C libraries with C++ files</title>
      <link>https://community.nxp.com/t5/MCUXpresso-IDE/Issues-with-using-C-libraries-with-C-files/m-p/1088299#M5958</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jx-jive-macro-user" href="https://community.nxp.com/people/converse"&gt;converse&lt;/A&gt;‌&lt;/P&gt;&lt;P&gt;"Check the ordering of your libraries if a function in library A calls a function in library B, then the ordering must be A B."&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Yes, I confirmed that the TX library is listed before the UX library.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"Also, in you example, is txe_mutual_create.c being built and included in the linker?"&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;As far as I can tell, yes.&amp;nbsp; I can locate the function in the TX library using both the image info tool and the NM tool Erich asked me to use.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;"Finally, you mention 'this file has the extern __cplusplus block around the entire file' can you clarify EXACTLY, what you are doing here. You need to use extern “C” Not extern __cplusplus.&lt;SPAN style="background-color: #ffffff; border: 0px; font-weight: inherit;"&gt;"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="background-color: #ffffff; border: 0px; "&gt;Both of the library header files use the common C file encapsulation:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/STRONG&gt;#ifdef __cplusplus // Two Underscores&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;/* Yes, C++ compiler is present. Use standard C. */&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;extern "C" {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;#endif&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;/* Library Header File */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;/* Determine if a C++ compiler is being used. If so, complete the standard&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;C conditional started above. */&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;#ifdef __cplusplus&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;#endif&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Regarding the libraries, the are included using the extern "C" syntax:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;extern "C"&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#include "tx_api.h"&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#include "ux_api.h"&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Based on the compiler information, it looks like all functions are being consistently used with the C name mangling.&amp;nbsp; Additionally, I am able to use all of the library functions that are only a single library deep and the problem seems to be specifically related to one library calling another library.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jun 2020 19:19:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-IDE/Issues-with-using-C-libraries-with-C-files/m-p/1088299#M5958</guid>
      <dc:creator>chadgraham</dc:creator>
      <dc:date>2020-06-11T19:19:29Z</dc:date>
    </item>
    <item>
      <title>Re: Issues with using C libraries with C++ files</title>
      <link>https://community.nxp.com/t5/MCUXpresso-IDE/Issues-with-using-C-libraries-with-C-files/m-p/1088300#M5959</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think to help any more, we are going to need to reproduce the issue. Can you provide an example that exhibits the same problem?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jun 2020 21:07:17 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-IDE/Issues-with-using-C-libraries-with-C-files/m-p/1088300#M5959</guid>
      <dc:creator>converse</dc:creator>
      <dc:date>2020-06-11T21:07:17Z</dc:date>
    </item>
    <item>
      <title>Re: Issues with using C libraries with C++ files</title>
      <link>https://community.nxp.com/t5/MCUXpresso-IDE/Issues-with-using-C-libraries-with-C-files/m-p/1088301#M5960</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A class="jx-jive-macro-user" href="https://community.nxp.com/people/converse"&gt;converse&lt;/A&gt;‌&lt;/P&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;Hopefully this works the same for you as it does for me, but here is a much trimmed down version of my project that does not compile.&amp;nbsp; It produces the same error as my main project and I left the file structure mostly the same.&amp;nbsp; (I removed includes and libraries not used by this sample.)&amp;nbsp; You may&amp;nbsp;need to download the RT1060-EVK SDK, but the project is otherwise self supporting.&amp;nbsp; Please let me know if you have any issues with it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Jun 2020 14:14:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-IDE/Issues-with-using-C-libraries-with-C-files/m-p/1088301#M5960</guid>
      <dc:creator>chadgraham</dc:creator>
      <dc:date>2020-06-12T14:14:15Z</dc:date>
    </item>
    <item>
      <title>Re: Issues with using C libraries with C++ files</title>
      <link>https://community.nxp.com/t5/MCUXpresso-IDE/Issues-with-using-C-libraries-with-C-files/m-p/1088302#M5961</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, that was trivial to solve. As I said yesterday&lt;/P&gt;&lt;P style="color: #51626f; border: 0px;"&gt;&lt;EM&gt;Check the ordering of your libraries if a function in library A calls a function in library B, then the ordering must be A B.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;All you need to do, is&amp;nbsp;re-order the libraries in the linker settings. I moved the 'tx' library to the bottom, so the order is now fx, ux, tx:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_3.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/112690i86FA4312D6C704A8/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_3.png" alt="pastedImage_3.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;To change the order, just select the library and click the down arrow in the top right. As you can see, the ordering of the libraries is critical.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Jun 2020 14:39:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-IDE/Issues-with-using-C-libraries-with-C-files/m-p/1088302#M5961</guid>
      <dc:creator>converse</dc:creator>
      <dc:date>2020-06-12T14:39:58Z</dc:date>
    </item>
    <item>
      <title>Re: Issues with using C libraries with C++ files</title>
      <link>https://community.nxp.com/t5/MCUXpresso-IDE/Issues-with-using-C-libraries-with-C-files/m-p/1088303#M5962</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A class="jx-jive-macro-user" href="https://community.nxp.com/people/converse"&gt;converse&lt;/A&gt;‌&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you!&amp;nbsp; I did play around with the library order, but misunderstood the implied sequence.&amp;nbsp; I was thinking that the library B would need to be loaded first so that it was available for A.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Jun 2020 14:53:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-IDE/Issues-with-using-C-libraries-with-C-files/m-p/1088303#M5962</guid>
      <dc:creator>chadgraham</dc:creator>
      <dc:date>2020-06-12T14:53:58Z</dc:date>
    </item>
    <item>
      <title>Re: Issues with using C libraries with C++ files</title>
      <link>https://community.nxp.com/t5/MCUXpresso-IDE/Issues-with-using-C-libraries-with-C-files/m-p/1088304#M5963</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #000000; background-color: #ffffff; font-size: 14px;"&gt;A library which calls an external function defined in another library should appear before the library containing the function.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Jun 2020 14:57:02 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-IDE/Issues-with-using-C-libraries-with-C-files/m-p/1088304#M5963</guid>
      <dc:creator>converse</dc:creator>
      <dc:date>2020-06-12T14:57:02Z</dc:date>
    </item>
  </channel>
</rss>

