cpputest: Docker cpputest breaks on #include
Greetings, I am encountering what appears to be this issue when trying to include ArduinoFake in a project that uses the docker version of cpputest. provided in cpputest-starter-project
In file included from /usr/local/include/c++/12.2.0/bits/hashtable.h:35, from /usr/local/include/c++/12.2.0/unordered_map:46, from mocks/ArduinoFake/src/ArduinoFake.h:8, from mocks/ArduinoFake/src/Arduino.h:1, from tests/MyFirstTest.cpp:3: /usr/local/include/c++/12.2.0/bits/hashtable_policy.h: In member function 'void std::__detail::_Local_iterator_base<_Key, _Value, _ExtractKey, _Hash, _RangeHash, _Unused, false>::_M_init(const __hash_code_base&)': /usr/local/include/c++/12.2.0/bits/hashtable_policy.h:1495:15: error: expected type-specifier before 'this' 1495 | { ::new(this->_M_h()) __hash_code_base(__base); }
The fix mentioned in the seems like something that cannot be tweaked within the dockerfile. Would I need to do a native build instead?
Many thanks
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 18 (7 by maintainers)
@ali-rostami The error you get is because of a placement operator new usage in STL. You seem to use the MakefileWorking.mk, which enables the “new macro” for adding memory leak info in line 307. Which means that the macro replacement will be included before the ordered list.
As @thetic mentioned, you’ll need to disable that. You can do that in the Makefileworker.mk by setting CPPUTEST_USE_MEM_LEAK_DETECTION to N. Then it will set the define that @thetic mentioned.
I mean at build time by defining
CPPUTEST_MEM_LEAK_DETECTION_DISABLED