C ++编译问题

时间:2013-05-03 07:53:24

标签: c++ gcc

meme@ubuntu:~/Data$ g++ UDPEchoServer.cpp PracticalSocket.cpp -o udpskserv -lsocket -lnsl -mt

我试图在我的编译器ubuntu上编译并收到此错误

cc1plus: error: unrecognized command line option ‘-mt’

我可以问什么是-mt,我试试谷歌但找不到任何信息。

如果我尝试省略-mt参数,我会收到此错误

PracticalSocket.cpp: In constructor ‘SocketException::SocketException(const string&, bool)’:
PracticalSocket.cpp:33:38: error: ‘strerror’ was not declared in this scope
PracticalSocket.cpp: In function ‘void fillAddr(const string&, short unsigned int, sockaddr_in&)’:
PracticalSocket.cpp:47:32: error: ‘memset’ was not declared in this scope
PracticalSocket.cpp: In member function ‘void Socket::setLocalPort(short unsigned int)’:
PracticalSocket.cpp:119:42: error: ‘memset’ was not declared in this scope
PracticalSocket.cpp: In static member function ‘static short unsigned int Socket::resolveService(const string&, const string&)’:
PracticalSocket.cpp:153:32: error: ‘atoi’ was not declared in this scope
PracticalSocket.cpp: In member function ‘void UDPSocket::disconnect()’:
PracticalSocket.cpp:291:40: error: ‘memset’ was not declared in this scope

1 个答案:

答案 0 :(得分:9)

std::memsetstd::strerror都在<cstring>标题中声明,您需要#include那个。

GCC没有-mt选项。