<?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>LPCXpresso IDEのトピックRe: Mix c and c++ code</title>
    <link>https://community.nxp.com/t5/LPCXpresso-IDE/Mix-c-and-c-code/m-p/646121#M32671</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is not an LPCXpresso IDE specific thing. There is a lot of information on mixing C and C++ code around on the web. For instance: "How do I call a C++ function from C?" &amp;nbsp;at&amp;nbsp;&lt;A class="link-titled" href="https://isocpp.org/wiki/faq/mixing-c-and-cpp#call-cpp" title="https://isocpp.org/wiki/faq/mixing-c-and-cpp#call-cpp"&gt;Standard C++&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;LPCXpresso Support&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 18 Oct 2016 17:51:26 GMT</pubDate>
    <dc:creator>lpcxpresso_supp</dc:creator>
    <dc:date>2016-10-18T17:51:26Z</dc:date>
    <item>
      <title>Mix c and c++ code</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Mix-c-and-c-code/m-p/646118#M32668</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My case is that i want to use a c++ library in an existing LpcOpen project for lpcxpresso 4367.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is this very useful tutorial for importing cpp code to c:&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://isocpp.org/wiki/faq/mixing-c-and-cpp" title="https://isocpp.org/wiki/faq/mixing-c-and-cpp"&gt;Standard C++&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Its clear that in order to compile c code, &lt;STRONG&gt;&lt;EM&gt;arm-non-eabi-gcc&lt;/EM&gt;&lt;/STRONG&gt;&lt;EM&gt; is needed and most often redlib is used.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;To compile cpp code &lt;STRONG&gt;&lt;EM&gt;arm-none-eabi-g++ &lt;/EM&gt;&lt;/STRONG&gt;&lt;EM&gt;is needed and newlib is used.&lt;/EM&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;EM&gt;I have done some research but some things are not yet clear to me.&lt;/EM&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;EM&gt;1. Can i compile lpcopen projects with g++ and newlib so that i can make the available lpcopen projects c++ projects?&lt;/EM&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;EM&gt; In this way as mentioned here &lt;A class="link-titled" href="https://www.lpcware.com/content/forum/error-message-c-files-mixing-c-project" title="https://www.lpcware.com/content/forum/error-message-c-files-mixing-c-project"&gt;Error message of c++ files mixing in c project. | www.LPCware.com&lt;/A&gt;&amp;nbsp;&lt;/EM&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;EM&gt;I can put C files into a C++ project.&lt;/EM&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;EM&gt;2. If i compile a library with g++ and an lpcopen projcet with gcc and use all the extern methods as described in &lt;A class="" href="https://isocpp.org/wiki/faq/mixing-c-and-cpp" title="https://isocpp.org/wiki/faq/mixing-c-and-cpp"&gt;Standard C++&lt;/A&gt; how can i link them all together?&lt;/EM&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;EM&gt;Any help would be appreciated.&lt;/EM&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;EM&gt;Thanks in advance,&lt;/EM&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;EM&gt;Dimitris&lt;/EM&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Oct 2016 09:58:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Mix-c-and-c-code/m-p/646118#M32668</guid>
      <dc:creator>dimitrissideris</dc:creator>
      <dc:date>2016-10-18T09:58:34Z</dc:date>
    </item>
    <item>
      <title>Re: Mix c and c++ code</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Mix-c-and-c-code/m-p/646119#M32669</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You will need to :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) Create an LPCOpen C++ project using the Quickstart -&amp;gt; New Project wizard&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) Reconfigure the LPCOpen board and chip libraries to build using Newlib rather than Redlib :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;A href="https://community.nxp.com/thread/389104"&gt;Switching the selected C library&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You might actually want to consider using NewlibNano rather than Newlib too.&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;A href="https://community.nxp.com/message/630732"&gt;https://community.nxp.com/message/630732&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;LPCXpresso Support&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Oct 2016 13:51:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Mix-c-and-c-code/m-p/646119#M32669</guid>
      <dc:creator>lpcxpresso_supp</dc:creator>
      <dc:date>2016-10-18T13:51:14Z</dc:date>
    </item>
    <item>
      <title>Re: Mix c and c++ code</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Mix-c-and-c-code/m-p/646120#M32670</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Thanx for the quick answer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My case is that i want to use an existing c++ library and use its functionality calling methods inside c code.&lt;/P&gt;&lt;P&gt;Can you suggest the most efficient way to achieve this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Lets say i want to use i2c example and read values from an i2c sensor.&lt;/P&gt;&lt;P&gt;And inside i2c.c code i want to call a method from c++ library? What should i do&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Oct 2016 14:37:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Mix-c-and-c-code/m-p/646120#M32670</guid>
      <dc:creator>dimitrissideris</dc:creator>
      <dc:date>2016-10-18T14:37:20Z</dc:date>
    </item>
    <item>
      <title>Re: Mix c and c++ code</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Mix-c-and-c-code/m-p/646121#M32671</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is not an LPCXpresso IDE specific thing. There is a lot of information on mixing C and C++ code around on the web. For instance: "How do I call a C++ function from C?" &amp;nbsp;at&amp;nbsp;&lt;A class="link-titled" href="https://isocpp.org/wiki/faq/mixing-c-and-cpp#call-cpp" title="https://isocpp.org/wiki/faq/mixing-c-and-cpp#call-cpp"&gt;Standard C++&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;LPCXpresso Support&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Oct 2016 17:51:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Mix-c-and-c-code/m-p/646121#M32671</guid>
      <dc:creator>lpcxpresso_supp</dc:creator>
      <dc:date>2016-10-18T17:51:26Z</dc:date>
    </item>
    <item>
      <title>Re: Mix c and c++ code</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Mix-c-and-c-code/m-p/646122#M32672</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My question is how can i make an existing lpcopen project that is a c project to a c++ project so that i can add an external c++ library with ease.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In an existing lpcopen project i changed the libs form redlib to newlib and that worked fine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can i use the c++ compiler (arm-none-eabi-c++) that lpcxpresso uses for c++ lpcopen projects when you create a new one to an existing lpcopen project?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried to do so but errors occur.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Once again my case is that i want to import an c++ library to an existing lpcopen project. For previous answers i understood that changing existing lpcopen c project to c++ would be the most efficient way to add a c++ library.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It would be very helpful if you could share what steps do i need to achieve this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Change all projects that are involved to newlib (chip and board also)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Use c++ compiler to an existing lpcopen project and make this c project to c++ ???????&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. ?????&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[EDIT] I also checked the eclipse feature of converting a c project to c++ but in LPCxpresso isn't feasible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your answers most time are swift and background prerequisites are needed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Oct 2016 08:41:40 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Mix-c-and-c-code/m-p/646122#M32672</guid>
      <dc:creator>dimitrissideris</dc:creator>
      <dc:date>2016-10-19T08:41:40Z</dc:date>
    </item>
  </channel>
</rss>

