I've got the following code:
vlib_stage_decoding_config_t Decoder::CfgTransform(const DecodingConfig config)
{
vlib_stage_decoding_config_t cfg;
return cfg;
}
void Decoder::OpenDecode(const DecodingConfig config)
{
vlib_stage_decoding_config_t int_cfg = CfgTransform(config);
vlib_stage_decoding_open(&int_cfg);
}
Header file:
public ref struct DecodingConfig
{
};
I get the following error:
Error 1 error C2664:
'Video::Decoding::Decoder::CfgTransform'
: cannot convert parameter 1 from'const Video::Decoding::DecodingConfig'
to'const Video::Decoding::DecodingConfig'
decoder.cpp
This is pretty nonsensic开发者_如何学Cal to me. Any ideas?
Try this:
vlib_stage_decoding_config_t Decoder::CfgTransform(DecodingConfig^ config)
{
vlib_stage_decoding_config_t cfg;
return cfg;
}
void Decoder::OpenDecode(DecodingConfig^ config)
{
vlib_stage_decoding_config_t int_cfg = CfgTransform(config);
vlib_stage_decoding_open(&int_cfg);
}
const
is meaningless for managed types.- Despite your use of
struct
,DecodingConfig
is a reference type, not a value type, so it cannot be passed without a tracking handle or a tracking reference. If you wantDecodingConfig
to be a value type, usevalue struct
instead ofref struct
and get rid of the^
s in your function arguments.
精彩评论