By default, these functions have external linkage. That means each translation unit has functions called double round(double r) and float round(float r), which causes a name collision at link time.
Some possible solutions are:
- Declare the functions as static, which implies internal linkage
- Inline the functions
- Move the implementation out of the header and into a c/c++ file
Read more here:
What is external linkage and internal linkage?
By the way, include guards protect a single translation unit from including a header file multiple times. That’s a different issue that what you’re seeing here.