Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - biatche

Pages: [1]
General Discussion / [nvapi] help with compiling.
« on: November 10, 2011, 12:33:35 PM »
Hello I don't really know what I'm doing... ok I do, I'm trying to compile an example app in nvapi docs and here's what I get:

Code: [Select]
W:\NVAPI\R285-developer>gcc test.c -o test.exe
In file included from test.c:2:0:
NvApiDriverSettings.h:837:19: error: expected ':', ',', ';', '}' or '__attribute
__' before '*' token
NvApiDriverSettings.h:845:19: error: expected ':', ',', ';', '}' or '__attribute
__' before '*' token

Code: [Select]
#include "nvapi.h"
#include "NvApiDriverSettings.h"
#include <stdlib.h>
#include <stdio.h>
This function is used to print to the command line a text message     describing the nvapi error and quits
void PrintError(NvAPI_Status status)
NvAPI_ShortString szDesc = {0};
NvAPI_GetErrorMessage(status, szDesc);
printf(" NVAPI error: %s\n", szDesc);
int main(int argc, char **argv)
NvAPI_Status status;

// (0) Initialize NVAPI. This must be done first of all
status = NvAPI_Initialize();
if (status != NVAPI_OK)         PrintError(status);
// (1) Create the session handle to access driver settings
NvDRSSessionHandle hSession = 0;
status = NvAPI_DRS_CreateSession(&hSession);
if (status != NVAPI_OK)         PrintError(status);
// (2) load all the system settings into the session
status = NvAPI_DRS_LoadSettings(hSession);
if (status != NVAPI_OK)         PrintError(status);
// (3) Obtain the Base profile. Any setting needs to be inside
// a profile, putting a setting on the Base Profile enforces it
// for all the processes on the system
NvDRSProfileHandle hProfile = 0;
status = NvAPI_DRS_GetBaseProfile(hSession, &hProfile);
if (status != NVAPI_OK)         PrintError(status);
// (4) Specify that we want the VSYNC disabled setting
// first we fill the NVDRS_SETTING struct, then we call the function
NVDRS_SETTING drsSetting = {0};
drsSetting.version = NVDRS_SETTING_VER;
drsSetting.settingId = VSYNCMODE_ID;
drsSetting.settingType = NVDRS_DWORD_TYPE;
drsSetting.u32CurrentValue = VSYNCMODE_FORCEOFF;
status = NvAPI_DRS_SetSetting(hSession, hProfile, &drsSetting);
if (status != NVAPI_OK)         PrintError(status);
// (5) Now we apply (or save) our changes to the system
status = NvAPI_DRS_SaveSettings(hSession);
if (status != NVAPI_OK)         PrintError(status);
// (6) We clean up. This is analogous to doing a free()
hSession = 0;
return 0;

Code: [Select]
D:\dump\nvapi-2011-june\R275-developer>gcc -v
Using built-in specs.
Target: x86_64-w64-mingw32
Configured with: ../gcc45-svn/configure --host=x86_64-w64-mingw32 --target=x86_6
4-w64-mingw32 --disable-multilib --enable-checking=release --prefix=/mingw64 --w
ith-sysroot=/mingw64 --enable-languages=c,c++,fortran,objc,obj-c++ --enable-lto
--enable-libgomp --with-gmp=/mingw64 --with-mpfr=/mingw64 --with-mpc=/mingw64 --
disable-nls --disable-win32-registry
Thread model: win32
gcc version 4.5.4 20111030 (prerelease) [svn/rev.180676 - mingw-w64/oz] (GCC)

Can anybody tell me what's going on?

Pages: [1]