我正在执行下一个命令:
docker login
Run Code Online (Sandbox Code Playgroud)
我得到的结果是:
Error saving credentials: error storing credentials - err: exit status 1, out:
`Cannot autolaunch D-Bus without X11 $DISPLAY`
Run Code Online (Sandbox Code Playgroud)
我在 Oracle Cloud 中使用了一个实例,它是:
Canonical-Ubuntu-16.04-2018.06.18-0
Run Code Online (Sandbox Code Playgroud)
我尝试修复它并提示下一个命令:
sudo apt-get install xorg openbox
Run Code Online (Sandbox Code Playgroud)
知道这里发生了什么吗?
我一直在研究如何做到这一点,所有的例子都是text/html.我已经尝试使用带有POCO C++网络库的JSON实现服务器api休息,但我不确定这是否是正确的方法.
void MyHandler::handleRequest(HTTPServerRequest& request, HTTPServerResponse& response)
{
response.setStatus(HTTPResponse::HTTP_OK);
response.setContentType("application/json");
std::ostream& ostr = response.send();
string send("true");
ostr << send;
response.setContentLength(send.size());
}
Run Code Online (Sandbox Code Playgroud)
最初它是为hmtl连接实现的:
void MyHandler::handleRequest(HTTPServerRequest& request, HTTPServerResponse& response)
{
response.setStatus(HTTPResponse::HTTP_OK);
response.setContentType("text/html");
std::ostream& ostr = response.send();
ostr << "<html><head><title>HTTPTimeServer powered by POCO C++ Libraries</title>";
ostr << "<body><p style=\"text-align: center; font-size: 48px;\">";
ostr << "ConfigHandler";
ostr << "</p></body></html>";
}
Run Code Online (Sandbox Code Playgroud)
我是否正确地完成了更改或者我错过了什么?
如果有人知道如何使用带有POCO C++库的JSON构建API REST的教程,我们将非常感激.
提前致谢.
如果我实现此代码,是否会产生内存泄漏?如果不是内存泄漏,何时删除内存?
class MyClass
{
public:
void foo() {
static MyClass *element = new MyClass();
}
};
Run Code Online (Sandbox Code Playgroud) 我在考虑这样的事情:
auto c = []() -> (int*) {int * b; b = new int(); b[0]=2; return b;};
Run Code Online (Sandbox Code Playgroud)
很抱歉,如果cuestion非常愚蠢,但我不确定为什么会产生编译错误:
Run Code Online (Sandbox Code Playgroud)main.cpp:3:18: error: expected type-specifier before '(' token auto c = []() -> (int*) {int * b; b = new int(); b[0]=2; return b;};