[En-Nut-Discussion] C++ support on Nut/OS ?

Harald Kipp harald.kipp at egnite.de
Tue Mar 23 12:33:20 CET 2010


Lost Jedi wrote:
> The query though is *how to add* the library to Nut/OS?
> Also going with the earlier query, the default nutcpp lib seems to have very limited c++ support. How do I add the gnu c++ lib to Nut/OS to include full C++ functionality?
If you check the older Changelog

http://ethernut.svn.sourceforge.net/viewvc/ethernut/trunk/ChangeLog20090309?revision=2709

you will notice that not much had been done for C++. Even in one of the
last entries I found

2009-01-09  Harald Kipp
* app/Makefile: Temporarily removed C++ sample due to problems with GCC 4.3.

I assume, that the linker scripts need some updates. That shouldn't be
too hard, because many samples are available in the Web.

For libraries in general, there is no need to add any changes. The most
simple way is to simply add the library source files to your application
build, e.g. nutapp/cppdemo/Makefile

  PROJ = cppdemo
  include ../Makedefs
  SRCS =  $(PROJ).cc mylibfile1.cc anotherlibfile.cc
  OBJS =  $(SRCS:.cc=.o)

You can even do this with the original nut/cpp/nutcpp.cc. Just copy it
from the source tree to your application directory.

You may remove -lnutcpp from the LIBS entry in your Makefile, though
it's not really required. The linker will automatically select your
local copy.

A more advanced way would be to enhance libnutcpp or create new C++
support libraries. But testing is much easier if you first check the
source code using the way described above. If everything works,
developers with write access to the repository will probably help. In
case this lib is open source and conforms to the Nut/OS license.

If you have a ready built library, you can simply add it to the LIBS
entry of your application's Makefile.

Harald










More information about the En-Nut-Discussion mailing list