5 Replies Latest reply on Feb 19, 2017 5:15 AM by user_1377889

    Error during build of PSoC 5 project when using .c and .h files

    nicolas.madrid

      Hi all,

         

      I am having a problem building a project when I try to use a .c source and .h header file in the project. When I build the project with all the code in the main.c file, everything works fine. However, when I move all the code except for int main() into a header and and c file and then add them to the project, I receive the following error: 

         

      .\CortexM3\ARM_GCC_493\Debug\main.o:(.data+0x10): multiple definition of `readPtr'
      .\CortexM3\ARM_GCC_493\Debug\RMISensor.o:(.data+0x10): first defined here
      collect2.exe: error: ld returned 1 exit status
      The command 'arm-none-eabi-gcc.exe' failed with exit code '1'.

         

      I actually get those first two lines a bunch of times for some of the variables I defined in the header file but I just included one as an example. It seems as though the main.o file is trying to define these variables despite it being removed from main.c. I've tried everything including completely remaking the project from scratch but haven't found a solution. I am using PSoC Creator 3.3.

         

      Thanks for the help.

         

      Nick