Leo P. answered 08/19/23
Professional C tutor for the University of Central Florida
The error message you're seeing suggests that there's a multiple definition problem. Even if the code is from an ECU in production, it doesn't necessarily mean that it will compile seamlessly in every environment. The issue might arise due to differences in how the ECU compiler and the minGW compiler manage certain aspects of the code.
Here are some steps to troubleshoot:
Double Compilation: Make sure that the file is not being compiled twice or linked twice in your build process. For example, ensure that the file isn't added twice in your project or makefile.
Include Guards: If you're including C files using #include "example.c" (instead of using headers), it can lead to multiple definition errors. Always use header files (example.h) for declarations and C files (example.c) for definitions. Also, use include guards or #pragma once in your header files to prevent double inclusion: