Macro incompatibility between lwip/sockets.h and functional libraries
Posted: Fri Jun 30, 2017 9:38 am
When I try to include the lwip/sockets.h, compilation throws the attached errors.
They seem to come from the fact that both the functional and sockets.h libraries have some different bind macros.
Since the functional library has never caused problems before, I assume the error lies in the combination of the two.
Has anyone experienced similar problems? Do I need to rename one of those macros to avoid this? If yes, is there a more convenient way? I don't really wan't to modify libraries publicly available, that only invites trouble if they get updates.
I will probably try some lower levels of lwip like netconn or raw next, maybe those don't face these restrictions.
Compiler errors:
They seem to come from the fact that both the functional and sockets.h libraries have some different bind macros.
Since the functional library has never caused problems before, I assume the error lies in the combination of the two.
Has anyone experienced similar problems? Do I need to rename one of those macros to avoid this? If yes, is there a more convenient way? I don't really wan't to modify libraries publicly available, that only invites trouble if they get updates.
I will probably try some lower levels of lwip like netconn or raw next, maybe those don't face these restrictions.
Compiler errors:
Code: Select all
CXX Socket.o
CXX Timing.o
In file included from /mnt/hgfs/c/Users/[redacted]/Projects/[redacted]/esp32/os_esp32/./../../components/os/../../components/util/Types.h:9:0,
from /mnt/hgfs/c/Users/[redacted]/Projects/[redacted]/esp32/os_esp32/./../../components/os/Socket.h:12,
from /mnt/hgfs/c/Users/[redacted]/Projects/[redacted]/esp32/os_esp32/./Socket.cpp:8:
/home/[redacted]/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/functional:1462:45: error: macro "bind" requires 3 arguments, but only 2 given
bind(_Func&& __f, _BoundArgs&&... __args)
^
/home/[redacted]/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/functional:1490:45: error: macro "bind" requires 3 arguments, but only 2 given
bind(_Func&& __f, _BoundArgs&&... __args)
^
In file included from /mnt/hgfs/c/Users/[redacted]/Projects/[redacted]/esp32/os_esp32/./../../components/os/../../components/util/Types.h:9:0,
from /mnt/hgfs/c/Users/[redacted]/Projects/[redacted]/esp32/os_esp32/./../../components/os/Socket.h:12,
from /mnt/hgfs/c/Users/[redacted]/Projects/[redacted]/esp32/os_esp32/./Socket.cpp:8:
/home/[redacted]/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/functional:1462:5: error: 'std::bind' declared as an 'inline' variable
bind(_Func&& __f, _BoundArgs&&... __args)
^
/home/[redacted]/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/functional:1464:7: error: expected primary-expression before 'typedef'
typedef _Bind_helper<false, _Func, _BoundArgs...> __helper_type;
^
/home/[redacted]/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/functional:1464:7: error: expected '}' before 'typedef'
/home/[redacted]/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/functional:1464:7: error: expected ';' before 'typedef'
/home/[redacted]/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/functional:1465:24: error: '__helper_type' has not been declared
typedef typename __helper_type::__maybe_type __maybe_type;
^
/home/[redacted]/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/functional:1466:24: error: '__helper_type' has not been declared
typedef typename __helper_type::type __result_type;
^
/home/[redacted]/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/functional:1467:7: error: expected unqualified-id before 'return'
return __result_type(__maybe_type::__do_wrap(std::forward<_Func>(__f)),
^
/home/[redacted]/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/functional:1473:24: error: expected template-name before '<' token
: _Bind_check_arity<typename decay<_Func>::type, _BoundArgs...>
^
/home/[redacted]/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/functional:1473:24: error: expected '{' before '<' token
/home/[redacted]/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/functional:1473:24: error: expected unqualified-id before '<' token
/home/[redacted]/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/functional:1490:5: error: 'bind' declared as an 'inline' variable
bind(_Func&& __f, _BoundArgs&&... __args)
^
/home/[redacted]/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/functional:1492:7: error: expected primary-expression before 'typedef'
typedef _Bindres_helper<_Result, _Func, _BoundArgs...> __helper_type;
^
/home/[redacted]/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/functional:1492:7: error: expected '}' before 'typedef'
/home/[redacted]/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/functional:1492:7: error: expected ';' before 'typedef'
/home/[redacted]/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/functional:1493:24: error: '__helper_type' has not been declared
typedef typename __helper_type::__maybe_type __maybe_type;
^
/home/[redacted]/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/functional:1494:24: error: '__helper_type' has not been declared
typedef typename __helper_type::type __result_type;
^
/home/[redacted]/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/functional:1495:7: error: expected unqualified-id before 'return'
return __result_type(__maybe_type::__do_wrap(std::forward<_Func>(__f)),
^
/home/[redacted]/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/functional:1497:5: error: expected declaration before '}' token
}
^
/home/[redacted]/esp/esp-idf/make/component_wrapper.mk:176: recipe for target 'Socket.o' failed
make[1]: *** [Socket.o] Error 1
make[1]: *** Waiting for unfinished jobs....
CXX test.o
/home/[redacted]/esp/esp-idf/make/project.mk:386: recipe for target 'os_esp32-build' failed
make: *** [os_esp32-build] Error 2