Hello,
I'm trying to use the funcitional library, however the compilation fails using CppUtest with "MakefileWorker.mk". But using my own makefile and arm-none-eabi it compiles. I also tried using eclipse enviroment (eclipse generates its custom makefile) and worked as well. Actually I'm trying to compile only one file, just the Alltests.cpp. If I comment out the #include <functional>, it works.
My termianl output follows:
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
CppUTest ok
CppUTest is configured. Ready to run 'test'
compiling AllTests.cpp
In file included from /usr/include/c++/8/functional:59,
from /home/gabriel/Projects/dt-07-fw-cacau_tiva/test/AllTests.cpp:18:
/usr/include/c++/8/bits/std_function.h: In static member function ‘static void std::_Function_base::_Base_manager<_Functor>::_M_clone(std::_Any_data&, const std::_Any_data&, std::true_type)’:
/usr/include/c++/8/bits/std_function.h:164:11: error: ‘__dest’ does not name a type
::new (__dest._M_access()) _Functor(__source._M_access<_Functor>());
^~~~~~
/usr/include/c++/8/bits/std_function.h:164:17: error: expected ‘)’ before ‘.’ token
::new (__dest._M_access()) _Functor(__source._M_access<_Functor>());
~ ^
)
/usr/include/c++/8/bits/std_function.h: In static member function ‘static void std::_Function_base::_Base_manager<_Functor>::_M_init_functor(std::_Any_data&, _Functor&&, std::true_type)’:
/usr/include/c++/8/bits/std_function.h:245:11: error: ‘__functor’ does not name a type
{ ::new (__functor._M_access()) _Functor(std::move(__f)); }
^~~~~~~~~
/usr/include/c++/8/bits/std_function.h:245:20: error: expected ‘)’ before ‘.’ token
{ ::new (__functor._M_access()) _Functor(std::move(__f)); }
~ ^
)
Building archive /home/gabriel/Projects/dt-07-fw-cacau_tiva/test/output/libdt-07-fw-cacau_tiva.a
Linking dt-07-fw-cacau_tiva_tests
g++: error: /home/gabriel/Projects/dt-07-fw-cacau_tiva/test/output//home/gabriel/Projects/dt-07-fw-cacau_tiva/test/AllTests.o: No such file or directory
Running dt-07-fw-cacau_tiva_tests
/bin/sh: ./dt-07-fw-cacau_tiva_tests: No such file or directory
Tests done
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
My AllTests.cpp
/**
* Includes
*/
#include "CppUTest/CommandLineTestRunner.h"
#include "CppUTestExt/MockSupportPlugin.h"
#include "CppUTest/TestPlugin.h"
#include "CppUTest/TestRegistry.h"
#include <functional>
/**
* Local Functions
*/
int main(int ac, const char** av)
{
MockSupportPlugin mockPlugin;
TestRegistry::getCurrentRegistry()->installPlugin(&mockPlugin);
int result = RUN_ALL_TESTS(ac, av);
return result;
}
My file to call MakefileWorker.mk:
# Parameters
COMPONENT_NAME= $(notdir $(shell pwd))# Project Name
PROJECT_PATH= $(shell pwd)# Project Path
CPPUTEST_HOME=${HOME}/cpputest
CPPUTEST_WARNINGFLAGS += -Wall
CPPUTEST_WARNINGFLAGS += -fmessage-length=0
# Set this to @ to keep the makefile quiet
# SILENCE = @echo
SILENCE = @
#---- Outputs ----#
TARGET_LIB = $(PROJECT_PATH)/test/output/lib$(COMPONENT_NAME).a
TEST_TARGET = $(COMPONENT_NAME)_tests
#--- Inputs ----#
PROJECT_HOME_DIR = .
CPP_PLATFORM = Gcc
CPPUTEST_OBJS_DIR = $(PROJECT_PATH)/test/output
CPPUTEST_LIB_DIR = $(PROJECT_PATH)/test/output
CPPUTEST_EXE_FLAGS = -v -c
INCLUDE_DIRS = $(CPPUTEST_HOME)/include \
TEST_SRC_DIRS += $(PROJECT_PATH)/test
CPPUTEST_USE_EXTENSIONS = Y
include $(CPPUTEST_HOME)/build/MakefileWorker.mk