NvAPI NVAPI_INTERFACE 缺少显式类型 [英] NvAPI NVAPI_INTERFACE Missing explicit type

查看:29
本文介绍了NvAPI NVAPI_INTERFACE 缺少显式类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 c++/cli 的新手,想为 nvapi 编写一个小的托管包装器.
现在尝试访问某些功能时(例如 NvAPI_Initialize)
Visual Studio 告诉我这个函数没有定义:

I'm new to c++/cli and would like to write a little managed wrapper for the nvapi.
Now when trying to access some functions (e.g. NvAPI_Initialize)
Visual Studio tells me that this function is not defined:

#include "nvapi.h";    

NvAPIStatus Nv_GPU_ThermalAPI::M_NvAPI_GPU_GetThermalSettings(System::UIntPtr gpuHandle,
                                                              Nv_Thermal_Target sensorIndex,
                                                              [Out] array<Nv_GPU_Thermal_Settings^>^% settings)
{
    NvAPI_Status res = NvAPI_Status::NVAPI_OK;             // OK
    NvPhysicalGpuHandle handle;                            // OK
    NV_GPU_THERMAL_SETTINGS *settings;                     // OK

    res = NvAPI_Initialize();                              // Error
    res = NvAPI_GPU_GetThermalStatus(handle, 0, settings); // same here
}

我已按照此处的描述包含了 nvapi.lib.

额外的 VS 告诉我,例如

Additional VS tells me that in e.g.

NVAPI_INTERFACE NvAPI_Initialize();

NVAPI_INTERFACE 缺少显式类型,将假定为int".
尝试构建我的代码此消息变成 C2059: 语法错误 'return' 并且 VS 在 100 个错误后取消构建.我使用的是 VS 2013 Pro.

NVAPI_INTERFACE is missing an explicit type and that 'int' would be assumed.
Trying to build my code this message turns into C2059: syntax error 'return' and VS cancels the build after 100 errors. I'm using VS 2013 Pro.

NVAPI_INTERFACE 定义如下:
'#define NVAPI_INTERFACE extern __success(return == NVAPI_OK) NvAPI_Status __cdecl'

NVAPI_INTERFACE is defined as follow:
'#define NVAPI_INTERFACE extern __success(return == NVAPI_OK) NvAPI_Status __cdecl'

推荐答案

我自己找到了答案.看来得补充一下

Found the answer myself. It seems one has to add

#include <Windows.h>

到 nvapi.h.

这篇关于NvAPI NVAPI_INTERFACE 缺少显式类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆