I am working on a PIC24 project, and I went to the project folder and moved a file to another directory inside the project folder, however, I got a makefile error. I created a new project and copied the source codes into the project I still get the same error.

make -f nbproject/Makefile-default.mk SUBPROJECTS= .build-conf
make[1]: Entering directory 'C:/Users/forat/MPLABXProjects/SerialComm_2_Micros_2.X'
make  -f nbproject/Makefile-default.mk dist/default/production/SerialComm_2_Micros_2.X.production.hex
make[2]: Entering directory 'C:/Users/forat/MPLABXProjects/SerialComm_2_Micros_2.X'
make[2]: *** No rule to make target 'build/default/production/System.o', needed by 'dist/default/production/SerialComm_2_Micros_2.X.production.hex'.  Stop.
make[2]: *** Waiting for unfinished jobs....
"C:\Program Files\Microchip\xc16\v1.60\bin\xc16-gcc.exe"   main.c  -o build/default/production/main.o  -c -mcpu=24FJ1024GB610  -MMD -MF "build/default/production/main.o.d"      -mno-eds-warn  -g -omf=elf -DXPRJ_default=default  -legacy-libc    -O0 -msmart-io=1 -Wall -msfr-warn=off    -mdfp="C:/Program Files (x86)/Microchip/MPLABX/v5.40/packs/Microchip/PIC24F-GA-GB_DFP/1.3.109/xc16"
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
make[2]: Leaving directory 'C:/Users/forat/MPLABXProjects/SerialComm_2_Micros_2.X'
nbproject/Makefile-default.mk:91: recipe for target '.build-conf' failed
make[1]: Leaving directory 'C:/Users/forat/MPLABXProjects/SerialComm_2_Micros_2.X'
nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed

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

Can someone help me, into why I got this error, I thought since it is not a syntax error, then if I create a new project and copied and pasted the code, I won't have this error.

I created a test project with a simple c code, and it got built successfully without any issues, it is only with my project that I got this error.

Your help is appreciated.


Hi guys,

in the error, it mentions the problem is with System.o I deleted the file System.h and created a new one with the same name and copied the code in it, the error disappeared when I build it.

Thank you guys for your help.

  • 1
    \$\begingroup\$ When you copy and compile an existing project MPLAB X fails. MPLAB X can not copy compile options properly, sometimes. Try to create a new blank project and copy your files separately. It worked on me before. \$\endgroup\$ Oct 7 '20 at 12:04
  • \$\begingroup\$ Tell MPLAB to 'clean' the project before you 'make' it. \$\endgroup\$
    – brhans
    Oct 7 '20 at 12:05
  • 1
    \$\begingroup\$ @brhans, I right-clicked on the project, cleaned it, and build it, I still get the same error. Is that what you mean by cleaning the project? Thanks \$\endgroup\$
    – Forat
    Oct 7 '20 at 22:58
  • \$\begingroup\$ @CCA I didn't copy an existing project, before getting messed up, all the individual project files were in GitHub, I simply created a new project, gave it a different name, created the c source files and h header files, and copied the code in GitHub into their associated source/header files \$\endgroup\$
    – Forat
    Oct 7 '20 at 22:59
  • \$\begingroup\$ Try to remove all your files from the project and then add them back. Be sure there are only .c files under Source Files \$\endgroup\$
    – Mike
    Oct 9 '20 at 8:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.