Details: SDK v15.2.0. Windows 8.1.
I am trying to adjust the ble_app_hts Makefile such that I can compile C++. I added cppmain.cpp to SRC_FILES and that threw me an error
_build/nrf52832_xxaa/cppmain.cpp.o: In function `idle_state_handle()': c:\Users\Michael\Documents\rStrap\nRF5_SDK_15.2.0_9412b96\examples\ble_peripheral\ble_app_hts\pca10040\s132\armgcc/../../../Src/cppmain.cpp:27: undefined reference to `nrf_pwr_mgmt_run()'
My cppmain.cpp looks like this
#include <cstdint>
#include "cppmain.h"
#include "nrf_pwr_mgmt.h"
#include "nrf_log.h"
#include "nrf_log_ctrl.h"
#include "nrf_log_default_backends.h"
void cppmain()
{
while(1)
{
idle_state_handle();
}
}
/**@brief Function for handling the idle state (main loop).
*
* @details If there is no pending log operation, then sleep until next the next event occurs.
*/
void idle_state_handle(void)
{
if (NRF_LOG_PROCESS() == false)
{
nrf_pwr_mgmt_run();
}
}
I can remove this error by adding extern "C" before the declaration of nrf_pwr_mgmt_run() but that's hacky. I'm surprised it even compiled tbh, I thought i would need to separate the SRC_FILES into CC/CXX/ASM but I noticed the .s in the list so I added my .cpp file. My next thought is to mix the Makefile with the one offered in this question, but if there is an easier way please let me know. I attached the Makefile (it shouldn't be called Makefile.makefile but just Makefile wouldn't upload).