Page 1 of 1

[nvapi] help with compiling.

Posted: Thu Nov 10, 2011 2:27 pm
by biatche
Hi, I just registered myself here to post this, I hope someone would be kind enough to help me out....
Well see, 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 all

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 all

#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);
	exit(-1);
}
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()
	NvAPI_DRS_DestroySession(hSession);
	hSession = 0;
	return 0;
}

Code: Select all

D:\dump\nvapi-2011-june\R275-developer>gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=c:/usr/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/4.5.4/l
to-wrapper.exe
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?

Re: [nvapi] help with compiling.

Posted: Sat Nov 26, 2011 7:11 pm
by Mind Calamity
Sorry I can't help you, but you did register and are asking for help on the wrong forum, register and ask here, and I'm sure you'll get answers.