ljj@ljj-think:~/C++/Project/07$ make
g++ -std=c++11 -c -Wall 7_27.cpp
In file included from 7_27.cpp:4:0:
Screen.h:43:14: error: expected initializer before ‘&’ token
inline Screen& Screen::move(pos r, pos c)
^
Screen.h:19:20: warning: inline function ‘Screen& Screen::move(Screen::pos, Scre
en::pos)’ used but never defined
inline Screen& move(pos r, pos c);
^
makefile:7: recipe for target 'main' failed
g++ -std=c++11 -c -Wall 7_27.cpp
In file included from 7_27.cpp:4:0:
Screen.h:43:14: error: expected initializer before ‘&’ token
inline Screen& Screen::move(pos r, pos c)
^
Screen.h:19:20: warning: inline function ‘Screen& Screen::move(Screen::pos, Scre
en::pos)’ used but never defined
inline Screen& move(pos r, pos c);
^
makefile:7: recipe for target 'main' failed
make: *** [main] Error 1
Ubuntu16.04 g++编译
出现此错误原因为Screen.h文件中的结构体最后没有加分号,如下所示:
Class Screen{
//........
}; //此处没有加分号导致此错误