   srand() compiler error - generating random sequence
  its been quite a while since i used the random number generator stuff but i am testing a function in a class that fills an array of shorts run time to create random numbers that will eventually be used for an image. for some reason i am getting a compiler error when trying to use srand() to be able generate a random sequence with each run. i am compiling in linux with g++ and the error i get is: Quote: In member function âshort unsigned int* myclass::get_vis_image(int, int, int)â:myclass.cpp:313: error: no match for call to â(std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >) (NULL)âin the myclass.h file is the files i will need:#include <ctime>#include <cstdlib>.....using namespace std;.....unsigned short *get_image(int, int, int);in the source:unsigned short * myclass::get_vis_image(int w, int h, int d){ unsigned short *image = new unsigned short[w * h * d]; srand(time(NULL)); for(int i = 0; i < w * h * d; i++)  image = abs((rand() % 65535) + 1); return image;}what does this error mean or what seems to be the problem? as far as i know the included header files for srand is there. thanks all in advance!   
  Perhaps std::time ?   ;  From the book I've been reading they used <time.h> for the header with srand()   ;Quote:Original post by ToohrVykPerhaps std::time ?yeah that worked. thanks. i was going to try that but then in my class.h file i declared to be working in the namespace std to begin with correct?? ;Quote:Original post by monpFrom the book I've been reading they used <time.h> for the header with srand()That would be even more painful, since the contents of time.h are not namespaced, and thus he would no way to solve the collision with his std::vector<std::string> time; variable.   ;  i am guessing that also ctime is also not namespaced so even if i said using namespace std above in the header file it was still giving me a compiler error?   ;Quote:Original post by OpenGL_Gurui am guessing that also ctime is also not namespaced so even if i said using namespace std above in the header file it was still giving me a compiler error?ctime is namespaced (this is why the identifier std::time actually exists). With using namespace std;, you also create a time identifier in the global namespace. However, since you also define a vector variable, which is also called time, that identifier in your functionrefers to the vector instead of the original function from ctime.   ;Quote:Original post by ToohrVykctime is namespaced (this is why the identifier std::time actually exists). -- ok understood. Quote:With using namespace std;, you also create a time identifier in the global namespace. -- how is this?Quote:However, since you also define a vector variable, which is also called time, that identifier in your functionrefers to the vector instead of the original function from ctime.-- when do i define a vector variable?like i said my time stuff is sort of hazy right now. thanks for the input...;Quote:Original post by OpenGL_Guru-- when do i define a vector variable?I have no idea. But g++ says that time is a vector of strings, so you must define it somewhere.