SyntaxFix
Write A Post
Hire A Developer
Questions
This problem happens because you are calling fun.cpp instead of fun.hpp. So c++ compiler finds func.cpp definition twice and throws this error.
fun.cpp
fun.hpp
Change line 3 of your main.cpp file, from #include "fun.cpp" to #include "fun.hpp" .
main.cpp
#include "fun.cpp"
#include "fun.hpp"