I recognize the error however think mine code need to be OK, clearly it this not. Yet this makes it hard to deal with it:

signature: int myfunc(ifstream &in, unsigned int & x, unsigned int &y);

main: ifstream myfile; myfile.open(file); unsigned int x; unsigned int y; myfunc(&myfile, &x, &y);

I might understand perhaps x and y no being lvalues? however I gain the very same error because that all 3 arguments. Any type of thoughts?

You are watching: Initial value of reference to non-const must be an lvalue


you're make the efforts to tie an deal with to a reference, for this reason don't. Try calling the function without the &

It just transforms the error. I get:

unresolved external symbol *int __cdecl...

The duty signature expects a reference.

I cant pass the val bc of the copy constructor ~ above ifstream.

See more: 25 Best Apps Like My Idol Make My Own Avatar Creator, Myidol · 3D Avatar Creator

/*Author: Andrew EmorySID: 382611lab_02.cpp: specifies the entry suggest for the console application.Purpose: */#include "stdafx.h"#include #include #include #include #include #include "game_pieces.h"#include "game_board.h"#include "exit_codes.h"#include "common_functions1.h"using namespace std;int main(int argc, char * argv<>){//check the the program got the correct variety of command line argumentsif (argc == too_few || argc > correct) char *prog_name = argv;char message<> = "you should pass a document name together the ONLY argument to this program, eg: toc-tac-toe.txt";usage_message(prog_name, message);return num_cli_args_failure;//open record and get board size or print error messagechar *file = argv;ifstream myfile;//myfile.open(file);//unsigned int xD = 0;//unsigned int yD = 0;unsigned int xD;unsigned int yD;try myfile.open(file);//if the routine cannot open up the file print a advantageous message and return appropriate exit codecatch (system_error&) char message<> = "could not open up file";usage_message(file, message);return ifile_failure;/*//creating pointers for error: "initial value of references tok non-const must be one lvalue"const ifstream *myfilePtr = &myfile;const unsigned int *xDPtr = xD;const unsigned int &*yDPtr = &yD;*///ifstream foo = &myfile;int return_val = 0;//this is weird elaborate//no suitable constructor exists to transform from "std::ifstream*" to "std::basic_ifstream>"https://signature int get_dimensions(ifstream & in, unsigned int & one, unsigned int & two);//while ((return_val = get_dimensions(&myfilePtr, &xDPtr, &yDPtr)) == extraction_failure) {while ((return_val = get_dimensions(*myfile, *xD, *yD)) == extraction_failure) continue;//get_dimensions(myfile, xD, yD);//no message below bc over there is one in acquire dimensions for iffile failureif (return_val == ifile_failure) return ifile_failure;else {vector game_pieces;unsigned int board_size = xD * yD;//for each place on the board repeatebly push earlier a game piece that represents an north square no the board right into the vectorfor (unsigned int ns = 0; i