g++4.8编译不了auto,已加-std=c++11

ubuntu14.04, 64位, gcc 4.8 g++4.8已装 

文件server_main.cpp_中

 int stringToInt(const std::string& str)
{   
    for(auto s : str)
    {
        if(!isdigit(s)) 
        {
            std::cout<<"illegal number";
            exit(-1);
        }
    }
    ...
}

makefile里代码如下:

 server_objects = m_socket.o serverSocket.o  server_main.o
client_objects = m_socket.o clientSocket.o  client_main.o

all : server client
server: $(server_objects)
    g++ -Wall -std=c++11 -o server $(server_objects)

client: $(client_objects)
    g++ -Wall -std=c++11 -o client $(client_objects)

m_socket: m_socket.cpp
    g++ -std=c++11 -Wall -o m_socket m_socket.cpp
serverSocket: serverSocket.cpp
    g++ -std=c++11 -Wall -o serverSocket serverSocket.cpp
clientSocket: clientSocket.cpp
    g++ -std=c++11 -Wall -o clientSocket clientSocket.cpp
**server_main: server_main.cpp
    g++ -std=c++11 -Wall -o server_main server_main.cpp  **
client_main: client_main.cpp
    g++ -std=c++11 -Wall -o server_main server_main.cpp

clean:
    rm -f *.o server client

执行make后

图片说明
请问怎么解决,是机子还是ubuntu的问题吗。。。。不胜感激。

查看全部
bilosphen
bilosphen
2016/05/07 18:23
  • 点赞
  • 收藏
  • 回答
    私信

2个回复