c++ - How to create a makefile for Unix -


ok keep receiving following error message:

g++    -c -o guess.o guess.cpp guess.cpp: in function ‘int main()’: guess.cpp:70:7: error: expected ‘}’ @ end of input    }    ^ guess.cpp:70:7: error: expected ‘}’ @ end of input guess.cpp:70:7: error: expected ‘}’ @ end of input make: *** [guess.o] error 1 

it referring last part of code is:

 cout << "think of integer between 1 , 1000. try guess it." << endl;    bool result = doguesses(0, 1001);       {   if (!result)                 {     cout << " , between 1 , 1000." << endl;     cout << "\n\ni demand rematch!" << endl;                }          } 

i have deleted } , added , still continue same error message. doing wrong?

makefile

this looks me. there couple of issues though.

guess:yesno.o guess.o     g++ guess yesno.o guess.o 

g++ needs -o option name output file. it's same syntax if you'd run in command line. , i'd put space after colon. i'm not sure if that's mandatory.

guess.o: yesno.h yesno.o: yesno.h 

guess.o , yesno.o need dependency respective cpp files.

like this:

guess.o: guess.cpp yesno.h