Multiple definition error for functions during linking of C++ library

I am trying to use the Edge Impulse C++ library on the MAX32660 microcontroller. I’ve been following the steps here: Deploy model as a C++ library

I’ve modified my Makefile to include all the files, generate object files, and then I use arm-none-eabi-gcc tool to begin linking all the object files. Upon linking, I start to see a large number of errors where every object file appears to be trying to redefine functions from included files:

c:/maximsdk/tools/gnutools/10.3/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: ./build/arm_rfft_init_q31.o: in function `arm_bitreversal_q15':
C:\Users\Henry\Documents\GitHub\computing-fiber\code\MAX32660\cpp_test1/edge-impulse-sdk/CMSIS/DSP/Source/TransformFunctions/arm_bitreversal.c:191: multiple definition of `arm_bitreversal_q15'; ./build/activations.o:C:\Users\Henry\Documents\GitHub\computing-fiber\code\MAX32660\cpp_test1/edge-impulse-sdk/CMSIS/DSP/Source/TransformFunctions/arm_bitreversal.c:191: first defined here
c:/maximsdk/tools/gnutools/10.3/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: ./build/arm_rfft_q15.o: in function `arm_bitreversal_f32':
C:\Users\Henry\Documents\GitHub\computing-fiber\code\MAX32660\cpp_test1/edge-impulse-sdk/CMSIS/DSP/Source/TransformFunctions/arm_bitreversal.c:49: multiple definition of `arm_bitreversal_f32'; ./build/activations.o:C:\Users\Henry\Documents\GitHub\computing-fiber\code\MAX32660\cpp_test1/edge-impulse-sdk/CMSIS/DSP/Source/TransformFunctions/arm_bitreversal.c:49: first defined here
c:/maximsdk/tools/gnutools/10.3/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: ./build/arm_rfft_q15.o: in function `arm_bitreversal_q31':
C:\Users\Henry\Documents\GitHub\computing-fiber\code\MAX32660\cpp_test1/edge-impulse-sdk/CMSIS/DSP/Source/TransformFunctions/arm_bitreversal.c:120: multiple definition of `arm_bitreversal_q31'; ./build/activations.o:C:\Users\Henry\Documents\GitHub\computing-fiber\code\MAX32660\cpp_test1/edge-impulse-sdk/CMSIS/DSP/Source/TransformFunctions/arm_bitreversal.c:120: first defined here
c:/maximsdk/tools/gnutools/10.3/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: ./build/arm_rfft_q15.o: in function `arm_bitreversal_q15':
C:\Users\Henry\Documents\GitHub\computing-fiber\code\MAX32660\cpp_test1/edge-impulse-sdk/CMSIS/DSP/Source/TransformFunctions/arm_bitreversal.c:191: multiple definition of `arm_bitreversal_q15'; ./build/activations.o:C:\Users\Henry\Documents\GitHub\computing-fiber\code\MAX32660\cpp_test1/edge-impulse-sdk/CMSIS/DSP/Source/TransformFunctions/arm_bitreversal.c:191: first defined here
c:/maximsdk/tools/gnutools/10.3/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: ./build/arm_rfft_q31.o: in function `arm_bitreversal_f32':
C:\Users\Henry\Documents\GitHub\computing-fiber\code\MAX32660\cpp_test1/edge-impulse-sdk/CMSIS/DSP/Source/TransformFunctions/arm_bitreversal.c:49: multiple definition of `arm_bitreversal_f32'; ./build/activations.o:C:\Users\Henry\Documents\GitHub\computing-fiber\code\MAX32660\cpp_test1/edge-impulse-sdk/CMSIS/DSP/Source/TransformFunctions/arm_bitreversal.c:49: first defined here
c:/maximsdk/tools/gnutools/10.3/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: ./build/arm_rfft_q31.o: in function `arm_bitreversal_q31':
C:\Users\Henry\Documents\GitHub\computing-fiber\code\MAX32660\cpp_test1/edge-impulse-sdk/CMSIS/DSP/Source/TransformFunctions/arm_bitreversal.c:120: multiple definition of `arm_bitreversal_q31'; ./build/activations.o:C:\Users\Henry\Documents\GitHub\computing-fiber\code\MAX32660\cpp_test1/edge-impulse-sdk/CMSIS/DSP/Source/TransformFunctions/arm_bitreversal.c:120: first defined here
c:/maximsdk/tools/gnutools/10.3/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: ./build/arm_rfft_q31.o: in function `arm_bitreversal_q15':
C:\Users\Henry\Documents\GitHub\computing-fiber\code\MAX32660\cpp_test1/edge-impulse-sdk/CMSIS/DSP/Source/TransformFunctions/arm_bitreversal.c:191: multiple definition of `arm_bitreversal_q15'; ./build/activations.o:C:\Users\Henry\Documents\GitHub\computing-fiber\code\MAX32660\cpp_test1/edge-impulse-sdk/CMSIS/DSP/Source/TransformFunctions/arm_bitreversal.c:191: first defined here
c:/maximsdk/tools/gnutools/10.3/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: ./build/arm_rms_f16.o: in function `arm_bitreversal_f32':
C:\Users\Henry\Documents\GitHub\computing-fiber\code\MAX32660\cpp_test1/edge-impulse-sdk/CMSIS/DSP/Source/TransformFunctions/arm_bitreversal.c:49: multiple definition of `arm_bitreversal_f32'; ./build/activations.o:C:\Users\Henry\Documents\GitHub\computing-fiber\code\MAX32660\cpp_test1/edge-impulse-sdk/CMSIS/DSP/Source/TransformFunctions/arm_bitreversal.c:49: first defined here
c:/maximsdk/tools/gnutools/10.3/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: ./build/arm_rms_f16.o: in function `arm_bitreversal_q31':
C:\Users\Henry\Documents\GitHub\computing-fiber\code\MAX32660\cpp_test1/edge-impulse-sdk/CMSIS/DSP/Source/TransformFunctions/arm_bitreversal.c:120: multiple definition of `arm_bitreversal_q31'; ./build/activations.o:C:\Users\Henry\Documents\GitHub\computing-fiber\code\MAX32660\cpp_test1/edge-impulse-sdk/CMSIS/DSP/Source/TransformFunctions/arm_bitreversal.c:120: first defined here
c:/maximsdk/tools/gnutools/10.3/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: ./build/arm_rms_f16.o: in function `arm_bitreversal_q15':
C:\Users\Henry\Documents\GitHub\computing-fiber\code\MAX32660\cpp_test1/edge-impulse-sdk/CMSIS/DSP/Source/TransformFunctions/arm_bitreversal.c:191: multiple definition of `arm_bitreversal_q15'; ./build/activations.o:C:\Users\Henry\Documents\GitHub\computing-fiber\code\MAX32660\cpp_test1/edge-impulse-sdk/CMSIS/DSP/Source/TransformFunctions/arm_bitreversal.c:191: first defined here
c:/maximsdk/tools/gnutools/10.3/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: ./build/arm_rms_f32.o: in function `arm_bitreversal_f32':
C:\Users\Henry\Documents\GitHub\computing-fiber\code\MAX32660\cpp_test1/edge-impulse-sdk/CMSIS/DSP/Source/TransformFunctions/arm_bitreversal.c:49: multiple definition of `arm_bitreversal_f32'; ./build/activations.o:C:\Users\Henry\Documents\GitHub\computing-fiber\code\MAX32660\cpp_test1/edge-impulse-sdk/CMSIS/DSP/Source/TransformFunctions/arm_bitreversal.c:49: first defined here
c:/maximsdk/tools/gnutools/10.3/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: ./build/arm_rms_f32.o: in function `arm_bitreversal_q31':
C:\Users\Henry\Documents\GitHub\computing-fiber\code\MAX32660\cpp_test1/edge-impulse-sdk/CMSIS/DSP/Source/TransformFunctions/arm_bitreversal.c:120: multiple definition of `arm_bitreversal_q31'; ./build/activations.o:C:\Users\Henry\Documents\GitHub\computing-fiber\code\MAX32660\cpp_test1/edge-impulse-sdk/CMSIS/DSP/Source/TransformFunctions/arm_bitreversal.c:120: first defined here
c:/maximsdk/tools/gnutools/10.3/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: ./build/arm_rms_f32.o: in function `arm_bitreversal_q15':
C:\Users\Henry\Documents\GitHub\computing-fiber\code\MAX32660\cpp_test1/edge-impulse-sdk/CMSIS/DSP/Source/TransformFunctions/arm_bitreversal.c:191: multiple definition of `arm_bitreversal_q15'; ./build/activations.o:C:\Users\Henry\Documents\GitHub\computing-fiber\code\MAX32660\cpp_test1/edge-impulse-sdk/CMSIS/DSP/Source/TransformFunctions/arm_bitreversal.c:191: first defined here
c:/maximsdk/tools/gnutools/10.3/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: ./build/arm_rms_q15.o: in function `arm_bitreversal_f32':
C:\Users\Henry\Documents\GitHub\computing-fiber\code\MAX32660\cpp_test1/edge-impulse-sdk/CMSIS/DSP/Source/TransformFunctions/arm_bitreversal.c:49: multiple definition of `arm_bitreversal_f32'; ./build/activations.o:C:\Users\Henry\Documents\GitHub\computing-fiber\code\MAX32660\cpp_test1/edge-impulse-sdk/CMSIS/DSP/Source/TransformFunctions/arm_bitreversal.c:49: first defined here
c:/maximsdk/tools/gnutools/10.3/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: ./build/arm_rms_q15.o: in function `arm_bitreversal_q31':
C:\Users\Henry\Documents\GitHub\computing-fiber\code\MAX32660\cpp_test1/edge-impulse-sdk/CMSIS/DSP/Source/TransformFunctions/arm_bitreversal.c:120: multiple definition of `arm_bitreversal_q31'; ./build/activations.o:C:\Users\Henry\Documents\GitHub\computing-fiber\code\MAX32660\cpp_test1/edge-impulse-sdk/CMSIS/DSP/Source/TransformFunctions/arm_bitreversal.c:120: first defined here

Drilling down into one of the errors as an example:

./build/arm_cfft_f16.o: in function `arm_bitreversal_f32':
./build/arm_cfft_f16.o: in function `arm_bitreversal_q15':
./build/arm_cfft_f16.o: in function `arm_bitreversal_q31':
./build/arm_cfft_f32.o: in function `arm_bitreversal_f32':
./build/arm_cfft_f32.o: in function `arm_bitreversal_q15':
./build/arm_cfft_f32.o: in function `arm_bitreversal_q31':
./build/arm_cfft_f64.o: in function `arm_bitreversal_f32':
./build/arm_cfft_f64.o: in function `arm_bitreversal_q15':
./build/arm_cfft_f64.o: in function `arm_bitreversal_q31':

These errors are in my build directory for arm_cfft_f16.o which should be the matching object file for arm_cfft_f16.c which is under “edge-impulse-sdk>CMSIS>DSP>Souce>TransformFunctions” and all the functions from arm_bitreversal.c are shown as having been defined, but there is no include of that file nor any function calls using them. (Unfortunately there doesn’t seem to be more description of the error for these ones) These errors then repeat for several hundred other object files.

It is not clear to me why there are all these errors if the generated header files from Edge Impulse SDK already have include guards. I see the same error if I try to compile with some of my own C header/source files. I’ve removed my own files and am just trying to compile a main.cpp file that only has example code for running a static_buffer test.

Any suggestions would be a great help! Could this be an issue with my Makefile?

Hi @henryc_mit,

Are you able to share your Makefile and main.cpp code (e.g. using pastebin or a GitHub gist)? We can try to recreate your issue. In the meantime, I might recommend checking out this post (not sure if it is helpful for your case, though): Includes when using preprocessing sdk

Hi Shawn,

I checked out that post earlier, but I don’t think it was helpful for the errors I am seeing.

I’ve made a separate Github repo (my main repo is currently private) with the example code I am trying to build: Github repo

The Makefile configuration is a little confusing because the vendor calls several other Makefiles to be included. I’ve pulled together the most important ones, where the main Makefile pulls together all the source files and then the “gcc.mk” file does the actual compiling/linking. The point where it gets hung up (I believe) is at the linking step: gcc.mk line 324

Thanks for taking a look

Side note: I love your intro videos on youtube/digikey. They’re some of the best tutorials I’ve found!

Hi @henryc_mit,

Thank you–I’m glad you enjoy the videos and find them helpful!

You’ll have to forgive me, as my Makefile fu is not particularly great, so outside of the Edge Impulse includes, I’m struggling to figure out what else is going on that could potentially trip up the linker. I asked one of our engineers about this, and here was their advice:

I don’t see anything weird in the Makefile. Did he try to make clean first? And run all the commands with the --verbose flag to find out if this file is included multiple times

I did make sure to run “make clean” first before each test build.
I just took a look at the object files and noticed that they look incorrect.

/MAX32660/cpp_test1/build$ nm arm_cfft_f16.o
00000000 t $t
00000000 t $t
00000000 t $t
00000001 T arm_bitreversal_f32
00000001 T arm_bitreversal_q15
00000001 T arm_bitreversal_q31
00000000 n wm4.0.6ae9af91854d5fa3f19dd029b8f7cd92
00000000 n wm4._ansi.h.31.de524f58584151836e90d8620a16f8e8
00000000 n wm4._default_types.h.15.247e5cd201eca3442cbf5404108c4935      
00000000 n wm4._intsup.h.10.48bafbb683905c4daa4565a85aeeb264
00000000 n wm4._newlib_version.h.4.bfdf54b0af045d4a71376ae00f63a22c      
00000000 n wm4._stdint.h.10.c24fa3af3bc1706662bb5593a907e841
00000000 n wm4._types.h.127.34941de1b2539d59d5cac00e0dd27a45
00000000 n wm4._types.h.20.dd0d04dca3800a0d2a6129b87f3adbb2
00000000 n wm4.arm_common_tables.h.30.69c06cf83a2204932d26465f77e4ca39   
00000000 n wm4.arm_math_memory.h.27.15b48442bebd15b7684ae775c0e94421     
00000000 n wm4.arm_math_types.h.86.d234ffd9523de96a34ed4dd0f785756f      
00000000 n wm4.cdefs.h.49.39045112216f6a021dbdffe3bf5accce
00000000 n wm4.cmsis_gcc.h.26.df817e776118b6b9e01af76275ae1495
00000000 n wm4.config.h.224.c701144a7b0518c6ee9b9b5465b79f81
00000000 n wm4.config.hpp.19.d5213b3970e9278e6f917333d4f1052a
00000000 n wm4.fast_math_functions.h.27.7a33cfd70c105fe21782dcc6228c73e9 
00000000 n wm4.features.h.33.318b64d71e0957639cfb30f1db1f7ec8
00000000 n wm4.float.h.29.0e9d9baf95ec39f9555dc80c6e28186b
00000000 n wm4.ieeefp.h.77.c88535c35f465c05b101960cf0179075
00000000 n wm4.limits.h.60.56a1ae353e2028a24298ec6463b8b593
00000000 n wm4.limits.h.9.70fb0ada6f71b16202a66baaa6d8ea70
00000000 n wm4.lock.h.2.1461d1fff82dffe8bfddc23307f6484f
00000000 n wm4.math.h.13.b6595ad277a643a6127e1a4515a98f91
00000000 n wm4.newlib.h.8.7cb3972cd43265932d4782d5eb589854
00000000 n wm4.none.h.38.4be1b9f179a1c13f1c2e05411cc4227a
00000000 n wm4.reent.h.17.e292bf8b0bec6c96e131a54347145a30
00000000 n wm4.reent.h.77.dcd6129ff07fe81bd5636db29abe53b2
00000000 n wm4.stddef.h.155.3588ebfdd1e8c7ede80509bb9c3b8009
00000000 n wm4.stddef.h.155.ba788add86a0e365f264484f110c3c29
00000000 n wm4.stddef.h.39.144cf5ddcd53cbfdac30259dc1a6c87f
00000000 n wm4.stdint.h.23.d53047a68f4a85177f80b422d52785ed
00000000 n wm4.string.h.15.dab3980bf35408a4c507182805e2de3a
00000000 n wm4.syslimits.h.34.de5cbd310098bc5895998b6bde577ed2
00000000 n wm4.utils.h.27.57524573fe37b04009eecf3582a4c591

/MAX32660/cpp_test1/build$ nm arm_bitreversal.o
00000000 t $t
00000000 t $t
00000000 t $t
00000001 T arm_bitreversal_f32
00000001 T arm_bitreversal_q15
00000001 T arm_bitreversal_q31
00000000 n wm4.0.6ae9af91854d5fa3f19dd029b8f7cd92
00000000 n wm4._ansi.h.31.de524f58584151836e90d8620a16f8e8
00000000 n wm4._default_types.h.15.247e5cd201eca3442cbf5404108c4935
00000000 n wm4._intsup.h.10.48bafbb683905c4daa4565a85aeeb264
00000000 n wm4._newlib_version.h.4.bfdf54b0af045d4a71376ae00f63a22c
00000000 n wm4._stdint.h.10.c24fa3af3bc1706662bb5593a907e841
00000000 n wm4._types.h.127.34941de1b2539d59d5cac00e0dd27a45
00000000 n wm4._types.h.20.dd0d04dca3800a0d2a6129b87f3adbb2
00000000 n wm4.arm_common_tables.h.30.69c06cf83a2204932d26465f77e4ca39
00000000 n wm4.arm_math_memory.h.27.15b48442bebd15b7684ae775c0e94421
00000000 n wm4.arm_math_types.h.86.d234ffd9523de96a34ed4dd0f785756f
00000000 n wm4.cdefs.h.49.39045112216f6a021dbdffe3bf5accce
00000000 n wm4.cmsis_gcc.h.26.df817e776118b6b9e01af76275ae1495
00000000 n wm4.config.h.224.c701144a7b0518c6ee9b9b5465b79f81
00000000 n wm4.config.hpp.19.d5213b3970e9278e6f917333d4f1052a
00000000 n wm4.fast_math_functions.h.27.7a33cfd70c105fe21782dcc6228c73e9
00000000 n wm4.features.h.33.318b64d71e0957639cfb30f1db1f7ec8
00000000 n wm4.float.h.29.0e9d9baf95ec39f9555dc80c6e28186b
00000000 n wm4.ieeefp.h.77.c88535c35f465c05b101960cf0179075
00000000 n wm4.limits.h.60.56a1ae353e2028a24298ec6463b8b593
00000000 n wm4.limits.h.9.70fb0ada6f71b16202a66baaa6d8ea70
00000000 n wm4.lock.h.2.1461d1fff82dffe8bfddc23307f6484f
00000000 n wm4.math.h.13.b6595ad277a643a6127e1a4515a98f91
00000000 n wm4.newlib.h.8.7cb3972cd43265932d4782d5eb589854
00000000 n wm4.none.h.38.4be1b9f179a1c13f1c2e05411cc4227a
00000000 n wm4.reent.h.17.e292bf8b0bec6c96e131a54347145a30
00000000 n wm4.reent.h.77.dcd6129ff07fe81bd5636db29abe53b2
00000000 n wm4.stddef.h.155.3588ebfdd1e8c7ede80509bb9c3b8009
00000000 n wm4.stddef.h.155.ba788add86a0e365f264484f110c3c29
00000000 n wm4.stddef.h.39.144cf5ddcd53cbfdac30259dc1a6c87f
00000000 n wm4.stdint.h.23.d53047a68f4a85177f80b422d52785ed
00000000 n wm4.string.h.15.dab3980bf35408a4c507182805e2de3a
00000000 n wm4.syslimits.h.34.de5cbd310098bc5895998b6bde577ed2

/MAX32660/cpp_test1/build$ nm arm_negate_f16.o
00000000 t $t
00000000 t $t
00000000 t $t
00000001 T arm_bitreversal_f32
00000001 T arm_bitreversal_q15
00000001 T arm_bitreversal_q31
00000000 n wm4.0.6ae9af91854d5fa3f19dd029b8f7cd92
00000000 n wm4._ansi.h.31.de524f58584151836e90d8620a16f8e8
00000000 n wm4._default_types.h.15.247e5cd201eca3442cbf5404108c4935
00000000 n wm4._intsup.h.10.48bafbb683905c4daa4565a85aeeb264
00000000 n wm4._newlib_version.h.4.bfdf54b0af045d4a71376ae00f63a22c
00000000 n wm4._stdint.h.10.c24fa3af3bc1706662bb5593a907e841
00000000 n wm4._types.h.127.34941de1b2539d59d5cac00e0dd27a45
00000000 n wm4._types.h.20.dd0d04dca3800a0d2a6129b87f3adbb2
00000000 n wm4.arm_common_tables.h.30.69c06cf83a2204932d26465f77e4ca39
00000000 n wm4.arm_math_memory.h.27.15b48442bebd15b7684ae775c0e94421
00000000 n wm4.arm_math_types.h.86.d234ffd9523de96a34ed4dd0f785756f
00000000 n wm4.cdefs.h.49.39045112216f6a021dbdffe3bf5accce
00000000 n wm4.cmsis_gcc.h.26.df817e776118b6b9e01af76275ae1495
00000000 n wm4.config.h.224.c701144a7b0518c6ee9b9b5465b79f81
00000000 n wm4.config.hpp.19.d5213b3970e9278e6f917333d4f1052a
00000000 n wm4.fast_math_functions.h.27.7a33cfd70c105fe21782dcc6228c73e9
00000000 n wm4.features.h.33.318b64d71e0957639cfb30f1db1f7ec8
00000000 n wm4.float.h.29.0e9d9baf95ec39f9555dc80c6e28186b
00000000 n wm4.ieeefp.h.77.c88535c35f465c05b101960cf0179075
00000000 n wm4.limits.h.60.56a1ae353e2028a24298ec6463b8b593
00000000 n wm4.limits.h.9.70fb0ada6f71b16202a66baaa6d8ea70
00000000 n wm4.lock.h.2.1461d1fff82dffe8bfddc23307f6484f
00000000 n wm4.math.h.13.b6595ad277a643a6127e1a4515a98f91
00000000 n wm4.newlib.h.8.7cb3972cd43265932d4782d5eb589854
00000000 n wm4.none.h.38.4be1b9f179a1c13f1c2e05411cc4227a
00000000 n wm4.reent.h.17.e292bf8b0bec6c96e131a54347145a30
00000000 n wm4.reent.h.77.dcd6129ff07fe81bd5636db29abe53b2
00000000 n wm4.stddef.h.155.3588ebfdd1e8c7ede80509bb9c3b8009
00000000 n wm4.stddef.h.155.ba788add86a0e365f264484f110c3c29
00000000 n wm4.stddef.h.39.144cf5ddcd53cbfdac30259dc1a6c87f
00000000 n wm4.stdint.h.23.d53047a68f4a85177f80b422d52785ed
00000000 n wm4.string.h.15.dab3980bf35408a4c507182805e2de3a
00000000 n wm4.syslimits.h.34.de5cbd310098bc5895998b6bde577ed2
00000000 n wm4.utils.h.27.57524573fe37b04009eecf3582a4c591

It appears that the functions from “arm_bitreversal.c” are somehow being found in each object file even though this source file is never included in the code base. Also, I don’t see any function names, mangled or otherwise, that correspond to that file’s code. For example, arm_negate_f16.o should have the function arm_negate_f16 somewhere in it.

I guess that must mean I’m doing something weird in the rule to build C/C++ files to object files. Though I don’t see what that could be yet.

I haven’t fixed the issue yet, but I found one issue in the Makefile based on that observation that my object files look the same.
The build rule I have here uses

$(BUILD_DIR)/%.o : $(C_SRCS)
	$(CC) $(CFLAGS) -o ${@} ${<}

And when I loop through and print out ${<}, it is just giving the first prerequisite (which is the expected behavior, I guess) rather than hopping over to the next source in the list.

I’ll need to modify that to make sure each object file gets the correct C/C++ file.

I’ve fixed the Makefile rule for generating the object files, so the linking proceeds much better. I now have a new issue where some CMSIS provided commands like __CLZ and __QADD are not declared in scope for files utils.h and controller_functions.h (under edge-impulse-sdk/CMSIS/DSP/Include/dsp directory).

Is this supposed to be an error that appears that I am meant to fix however I want, in terms of defining their macros? I see there is a CMSIS file that defines the macros but it does not appear that those macros are not actually included in the example Makefile given (generic C++ library link). Is the easiest fix just defining the macros in the header files that need it?

I also see that I could use some GCC intrinsic functions, but I’d like to know if I was intended to be doing such modifications myself. It seems like I should be able to just drop in the C++ library without having to do this.

hi @henryc_mit, are you still working on this? Can you post your latest full build output?

The short answer is no, you shouldn’t have to provide those intrinsics. I assume you’re compiling with gcc…can you post the output of this command:
gcc --version