Loading...
 
Skip to main content

System Workbench for STM32


Problem with "undefined reference to"

France

Hi David,

The problem here is that the math_helper.c file is a C program and your main.cpp is obviously a C++ program. You must slightly modify the math_helper.h file so that it declares its functions correctly to be called from C++: You should add, just after line 47 in math_helper.h:
Copy to clipboard
#ifdef __cplusplus extern "C" { #endif
and just before the final #endif
Copy to clipboard
#ifdef __cplusplus } #endif

so that your functions are properly declared as C functions when math_helper.h is included in main.cpp.

Hope this helps,

Bernard (Ac6)