First a disclaimer. I've been reading the multitude of questions on this topic, yet I can't get mine to work for me. Mostly I was basing my attempt off of this link, which seems to imply that as long as the function definition has & in it, then I can just pass the object into the function by name. However I keep getting the following errors:
assembler.cpp: In function ‘int main()’: assembler.cpp:56:21: error: invalid initialization of non-const reference of type ‘Symbol_Table&’ from an rvalue of type ‘Symbol_Table (*)()’ get_input(Table_obj);
assembler.cpp:30:6: error: in passing argument 1 of ‘void get_input(Symbol_Table&)’ void get_input(Symbol_Table& Table_ptr)
As for my actual code, the relevant bits are below. The get_input function is just reading from a file and creating an object of a different type to work with. Through the course of the program running, the Symbol_Table object will have it's members changed so I need to pass it by reference without it being const, which was the only "solution" I could find.
void get_input(Symbol_Table& Table_ptr)
{
do_stuff();
}
int main()
{
Symbol_Table Table_obj();
get_input(Table_obj);
}
I don't think the class definition of Symbol_Table is needed, but I can edit it in if needed.