Hi Paolo,
Welcome to esp-open-rtos! Hopefully you find it useful for your purposes. :)
On Tue, Dec 29, 2015 at 09:52:21AM -0800, paolo achdjian wrote:
> Hi,
> I started few days ago use esp2866 and then esp-open-rtos.
> I like C++ so I prefer use this instead of simple C, but it seems to me
> that there is some problem using the standard library (when I use
> std::string and std::ostream the linker reports me some undefined symbols
> and/or some weird warning about wrong relocation).
> Anyway, I haven't to do a large program, so this limits can be easy
> bypassed.
> Instead, one thing that interests to me is using the version 11 of c++,
> because it seems to me that it offers a lot of vantages about embedded
> system.
>
> To enable the c++ 11 version, it enough use the flag -std=c++11 but the
> problem is that the only way I be able to use it without problem it is
> modify the
common.mk file as:
>
> CXXFLAGS = $(C_CXX_FLAGS) -fno-exceptions -fno-rtti* -std=c++11*
>
> because adding this flag any other variable in the project Makefile produce
> error when compiling simple C file.
> So, I would be glad if will be added a variable only for C++, in order to
> be possible choice the C++ version.
There is a way to do this with the current Makefile, if you only want C++11 for your program files:
program_CXXFLAGS = $(CXXFLAGS) -std=c++11
... this way any C++ files compiled in the rest of the framework will use the default C++ standard, and only your program files are compiled as C++11. Which may be what you want.
However I also just pushed a commit that adds EXTRA_CXXFLAGS, EXTRA_CFLAGS, and also makes the top-level CFLAGS/etc overridable. So it's up to you which one to use, I guess.
> Furthermore, I noticed that to use the c++11, there is a little change to
> performe in the ip_addr.h file of lwip library: it is need to add some
> space in the definition of ip_addr_debug_print in order to allowing the
> compiler to well understand the syntax .
OK. Can you please send a pull request to
https://github.com/SuperHouse/esp-lwip with whatever changes are required in order to compile with C++11? I'll merge it and update the submodule.
Angus