**关闭。**此题需要debugging details。目前不接受答复。
编辑问题以包括desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem。这将帮助其他人回答这个问题。
昨天关门了。
Improve this question
我正在尝试将nlohmann json包含到QtQuick项目中。当我尝试使用json创建一个变量时,我会得到以下错误:
No matching constructor for initialization of 'Json' (aka 'basic_json<>')
json.hpp:20110:5: candidate constructor not viable: requires at most 3 arguments, but 4 were provided
json.hpp:20225:5: candidate constructor not viable: requires 2 arguments, but 4 were provided
json.hpp:20238:5: candidate constructor template not viable: requires 2 arguments, but 4 were provided
json.hpp:20023:5: candidate constructor not viable: requires single argument 'v', but 4 arguments were provided
json.hpp:20031:5: candidate constructor not viable: requires at most 1 argument, but 4 were provided
json.hpp:20043:5: candidate constructor template not viable: requires single argument 'val', but 4 arguments were provided
json.hpp:20057:5: candidate constructor template not viable: requires single argument 'val', but 4 arguments were provided...
json.hpp:20352:5: candidate constructor not viable: requires single argument 'other', but 4 arguments were provided
json.hpp:20421:5: candidate constructor not viable: requires single argument 'other', but 4 arguments were provided
openai.hpp:608:45: passing argument to parameter 'input' here
生成这些错误的代码:
auto completion = openai::completion().create({ //JSON request
{"model", "text-davinci-003"},
{"prompt", Context},
{"max_tokens", 100},
{"temperature", 0}
});
Qt版本是6.5.0。代码可以在VS中运行,但不能在Qt中运行。
我试图实现一个变量,但我在Qt中使用nlohmann json时出现JSON错误。
1条答案
按热度按时间5rgfhyps1#
我找到了解决问题的办法。在Qt中,你需要为json请求引入这些库: