how can I pass a matrix as a reference parameter?
I am using the following declarations:

Code:
typedef std::vector< std::vector<std::string> > ss_matrix_t;

I declare the matrix with the following statement, where nRows and nCols are integers

Code:
std::vector< std::vector<std::string> > vI2Matrix(nRows, std::vector<std::string>(nCols,""));



The function is called with:

Code:
int read_files(std::string fname, int nCols, int nRows,  ss_matrix_t &ssMat )
but I get a linker error:


error LNK2019: unresolved external symbol "int __cdecl read_splayed_files(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,int,int,class std::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > >,class std::vector<class std::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > >,class std::allocator<class std::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > > >)" (?read_files@@YAHV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@HHV?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@2@V?$vector@V?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@V?$allocator@V?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@@2@@2@@Z) referenced in function "int __cdecl readDatafile(void)" (?readDatafile@@YAHXZ)
1>C:\PROJECTS\cppVS2010\Harness\Debug\Harness.exe : fatal error LNK1120: 1 unresolved externals

I suspect the syntax of the declaration, but I am not sure what to do here?


If I change the call to the function, then the array ( matrix ) is passed by value, and it takes forever:


Code:
int read_files(std::string fname, int nCols, int nRows,  ss_matrix_t ssMat )
// this takes ages ( it does compile and link )

How can this be resolved?

Any advice appreciated

Jefe