There is nothing obviously wrong with the code you have posted. It depends on what code is around it and how you are calling this function. The error message probably give you more information.
If you want to allow non-rectangular rooms you might want to store polygons in the vector instead. Another possibility is to allow many rectangles to represent one room. Instead of using rectangles you might want to use triangles because they are more flexible (triangles are used a lot in computer graphics).
Example of separating room in several rectangles: http://puu.sh/kM6MC/890f873f8b.png
Notice that using arbitrary triangles instead of axis-aligned rectangles will allow you to represent any polygon.
The code you posted looks like a declaration, but it doesn't declare a return value, which is required in C++, so it probably should be: int average(const std::vector<double>& values);