It's an issue with the std namespace.
Change the declaration in the header to:
int VectorSum (const std::vector<int>& values); And make sure there's either a using namespace std; in the .cpp file(s) (like your first example) or that you use the std namespace appropriately when calling/defining the function. For example, you'd need to do one of these things in your VectorSum.cpp file.
As an aside, please don't add a
using namespace std; statement to the header file. That will force the namespace to be brought into scope for all users of the header (even if it's indirectly included, so it might not be obvious), which might not fit their wants or needs.