I have a class for sorting a char array. One of the constructors takes the parameter (size_t length). When I pass it a length of type int and try to compile, I get the error
driver.cpp:(.text+0x2c): undefined reference to 'Array::Array(unsigned long)'
Is there something obvious I am missing? What can I attempt to try to get this code to compile.
I have tried creating a variable of size_t but I get the same error. I have tried changing the parameter to an integer to see if had something to do with it being type size_t, but i get the same error but for int instead.
driver.cpp:(.text+0x2c): undefined reference to 'Array::Array(int)'
Array.h
class Array{
public:
Array(size_t length);
...
...
}
Array.cpp
Array::Array (size_t length)
{
std::cout << "garbage output" << std::endl;
}
main.cpp
int main (int argc, char * argv [])
{
// TODO Add code here to test your Array class.
Array ar1(10);
return 0;
}
I expect the string "garbage output" but I receive a compilation error.