On Mon, 2016-05-09 at 23:52 +0800, Jesse wrote: > I wrote a c++ program which contains "auto". > And I've wrote the makefile: g++ -std=c++11 ....... > However, it still remind of "..does not name a type ..." > I've searched on the net for solution but gain nothing. > I think it might be a bug in make??
No, your makefile is wrong. > details can be found in appended pictures. Most people prefer to read text email not HTML, so please cut and paste text instead of attaching pictures. You can clearly see the problem by looking at the output make is printing for the compile line: c++ -c -o server_main.o server_main.cpp Note that your flags -Wall -std=c++11 are not there. That means that make is not using your rule. Why not? Look at your rule: server_main: server_main.cpp g++ -std=c++11 -Wall -o server_main server_main.cpp This rule builds a file named "server_main" which is an executable (no -c option provided to the compiler). But you've asked make to build a target file named "server_main.o", so this rule doesn't match. Because you haven't defined any rule to build "server_main.o", make will use one of its built-in rules. I don't see any reason why you need to define all these rules yourself. Why not just use make's built-in rules always? Then you can just write this as your makefile: server_objects = ...your objects... client_objects = ...your objects... CXX = g++ CXXFLAGS = -Wall -std=c++11 all: server client server: $(server_objects) client: $(client_objects) That's it, all done. _______________________________________________ Bug-make mailing list Bug-make@gnu.org https://lists.gnu.org/mailman/listinfo/bug-make