I have a vector that I want to pass into a function. However I keep getting the error message
/tmp/ccxdV4vZ.o: In function `main':
new.cpp:(.text+0xf6): undefined reference to `up(std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: ld returned 1 exit status
The function takes a vector, which contains a 20x20 matrix, and sums four consecutive values up the columns and stores the values in a second vector.
I know my error is in how I'm passing the vector, but I can't tell if it's in the function prototype, the way im calling it, or the definition of the function after main.
The prototype doesn't match the definition. If you wish to modify the vector directly from the function you must pass by reference (definition does) or by pointer. The former would be best.