# DSP Library not working in MPLAB X

I have to make a digital filter with a dsPIC30F4011 (I'm completely new to microcontrollers). I was reading the documentation about the DSP Library to figure out how to use it. I created a simple C program based on a piece of code I saw in the documentation:

#include <stdio.h>
#include <stdlib.h>
#include <p30F4011.h>
#include <dsp.h>
#include <xc.h>

int main(int argc, char** argv) {

fractional *dstV;
fractional srcV1[2] = {Q15(0.2), Q15(0.2)};
fractional srcV2[2] = {Q15(0.5), Q15(0.5)};

dstV = VectorAdd(2, dstV, srcV1, srcV2);

int n = 1;

return (EXIT_SUCCESS);
}


But when I build it, I get the following messages:

build/default/production/main.o(.text+0x22): In function _main':
make[2]: *** [dist/default/production/test-dspic.X.production.hex] Error 255
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
nbproject/Makefile-default.mk:135: fallo en las instrucciones para el objetivo 'dist/default/production/test-dspic.X.production.hex'
make[2]: se sale del directorio '/home/adrian/MPLABXProjects/test-dspic.X'
nbproject/Makefile-default.mk:90: fallo en las instrucciones para el objetivo '.build-conf'
make[1]: se sale del directorio '/home/adrian/MPLABXProjects/test-dspic.X'
nbproject/Makefile-impl.mk:39: fallo en las instrucciones para el objetivo '.build-impl'

BUILD FAILED (exit value 2, total time: 1s)


It says that the function VectorAdd isn't defined. Is there something wrong or missing?

• Have you reviewed 51456b.pdf (Microchip dsPIC Language Tools Libraries) section 2.2.1? libdsp-omf.a is also required by the linker. – isdi Nov 13 '18 at 3:35
• I tried with that file, but didn't work. Then I tried with libdsp-elf.a and the project was built successfully. – user25707 Nov 13 '18 at 16:44