SDK 11.0 nvEncOpenEncodeSessionEx NV_ENC_ERR_INVALID_VERSION

With SDK 11.0 nvEncOpenEncodeSessionEx is returning error code 15 (NV_ENC_ERR_INVALID_VERSION).

I have GeForce Driver 457.09
GPU: 2070 Super
Cuda: 11.1

Code used:

	NVENCSTATUS ret;

	NvEncodeAPICreateInstance(&mFunctions);

	NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS encodeSessionExParams;
	encodeSessionExParams.version = NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS_VER;
	encodeSessionExParams.device = kCudaContext;
	encodeSessionExParams.deviceType = NV_ENC_DEVICE_TYPE_CUDA;
	encodeSessionExParams.apiVersion = NVENCAPI_VERSION;

	ret = mFunctions.nvEncOpenEncodeSessionEx(&encodeSessionExParams, &mEncoder);
	if (ret != NV_ENC_SUCCESS)
	{
		mEncoder = nullptr;
		std::cout << "nvEncOpenEncodeSessionEx error: " << ret << std::endl;
		return;
	}

Thanks for any help

Just got the samples to work so obviously the problem is in my code/project settings. No idea what though.

Found the bug, I wasn’t setting the version in NV_ENCODE_API_FUNCTION_LIST.

Is this documented anywhere apart from the header file? I’m finding the docs to be a bit light.