Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C++ compile issue

Tags:

c++

gcc

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

I trying to compile at my compiler ubuntu and i receive this error

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

May i ask what is -mt , i try google but can't find any information.

If I try omit the -mt parameter i get this error

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
like image 625
user2017011 Avatar asked May 03 '13 07:05

user2017011


1 Answers

Both std::memset and std::strerror are declared in the <cstring> header, you need to #include that one.

And GCC does not have a -mt option.

like image 51
Some programmer dude Avatar answered Sep 22 '22 03:09

Some programmer dude