使用v8时不推荐使用的警告

问题描述

我正在使用node-gyp构建C ++插件,每次构建时都会收到以下警告:

warning C4996: 'v8::Object::Get': was declared deprecated
warning C4996: 'v8::Object::Get': was declared deprecated

与此代码有关,其中我从要解析的JSON中声明了 std :: string 变量:

void water(const FunctionCallbackInfo<Value> &args)
    {
        try{
        namespace pt = boost::property_tree;
        pt::ptree root;
        pt::read_json("waterjson.json",root);
        
            Local<Array> a = args[0].As<Array>();
            Local<Array> b = args[1].As<Array>();

            int total = 0;
            for (std::size_t i = 0; i < a->Length(); i++)
            {
                v8::Isolate *isolate = args.GetIsolate();
                v8::String::Utf8Value atr(isolate,a->Get(i));
                std::string cppStr(*atr);

                int c = root.get<int>(cppStr + ".content");
                int s = root.get<int>(cppStr + ".serving");
                int m = s / 100;
                int amount = c * m;
                v8::String::Utf8Value btr(isolate,b->Get(i));
                std::string cppNum(*btr);
                int num = stoi(cppNum);
                total += (amount * num);
            }
            args.GetReturnValue().Set(total);
        }
        catch(int e)
        {
            args.GetReturnValue().Set(-e);
        }
        
    }

关于如何消除此错误的任何想法?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...