gpt4 book ai didi

C++编译问题

转载 作者:太空狗 更新时间:2023-10-29 19:58:56 29 4
gpt4 key购买 nike

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

最佳答案

两者都是 std::memsetstd::strerror<cstring> 中声明标题,你需要 #include那个。

而且 GCC 没有 -mt选项。

关于C++编译问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16354058/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com