# PVRScope example code seems doesn't work.

**URL:** <https://forums.imgtec.com/t/pvrscope-example-code-seems-doesnt-work/1457>\
**Category:** PowerVR Insider\
**Tags:** pvrscope\
**Created:** [June 28, 2012, 7:35am UTC](https://forums.imgtec.com/t/pvrscope-example-code-seems-doesnt-work/1457 "2012-06-28T07:35:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![y1m1n9](https://avatars.discourse-cdn.com/v4/letter/y/35a633/32.png) [@y1m1n9](https://forums.imgtec.com/u/y1m1n9)\
**Post date:** [June 28, 2012, 7:35am UTC](https://forums.imgtec.com/t/pvrscope-example-code-seems-doesnt-work/1457/1 "2012-06-28T07:35:30Z")

</div>

Hi, I’ve tried to compile example code copy from PVRScope user manual, the code listed below:

  

```  
#include "PVRScope.h"  
  
  
  
int main(void)  
  
{  
  
// Create the PVRScope data storage area  
  
SPVRScopeImplData\* scopeData;  
  
// Initialise PVRScope  
  
const EPVRScopeInitCode returnCode = PVRScopeInitialise(scopeData);  
  
// Check initialisation succeeded  
  
if(returnCode != ePVRScopeInitCodeOk)  
  
{  
  
// Handle the error  
  
}  
  
// Create an array of counter definitions  
  
unsigned int numCounters = 0;  
  
SPVRScopeCounterDef \*counterArray = 0;  
  
// Create the data structure to contain the counter readings  
  
SPVRScopeCounterReading counterReadings;  
  
// Continue initialisation  
  
if(scopeData)  
  
{  
  
PVRScopeGetCounters(scopeData, &numCounters, &counterArray, &counterReadings);  
  
}  
  
  
  
// Select the desired counter group (3 in this instance)  
  
unsigned int desiredGroup = 3;  
  
// Store which group is currently active  
  
unsigned int activeGroup = 0;  
  
// Do a quick check to save some processing  
  
if(desiredGroup == activeGroup)  
  
desiredGroup = 0xffffffff;  
  
// Update the counters and store the active group  
  
if(PVRScopeReadCountersThenSetGroup(scopeData, &counterReadings, desiredGroup))  
  
activeGroup = counterReadings.nReadingActiveGroup;  
  
// Read the counters from the above group, and process them accordingly.  
  
// The counters will match (in order) the elements in â€˜counterArrayâ€™ whose group  
  
// matches â€˜counterReadings.nReadingActiveGroupâ€™  
  
  
  
// De-initialise PVRScope  
  
PVRScopeDeInitialise(&scopeData, &counterArray, &counterReadings);  
  
  
  
return 0;  
  
}

````auto
<font color="#0000ff"><br></font>
```<pre>then i compile it:</pre>```
<font color="#0000ff">gcc pvrtest.c</font>

````

A lot of errors were printed:

````auto
<font color="#0000ff">In file included from pvrtest.c:1:<br />
PVRScope.h:42: error: expected specifier-qualifier-list before â€˜boolâ€™<br />
PVRScope.h:68: error: expected â€˜=â€™, â€˜,â€™, â€˜;â€™, â€˜asmâ€™ or â€˜ __attribute__ â€™ before â€˜PVRScopeInitialiseâ€™<br />
PVRScope.h:75: error: expected â€˜)â€™ before â€˜*â€™ token<br />
PVRScope.h:84: error: expected â€˜)â€™ before â€˜*â€™ token<br />
PVRScope.h:92: error: expected â€˜=â€™, â€˜,â€™, â€˜;â€™, â€˜asmâ€™ or â€˜ __attribute__ â€™ before â€˜PVRScopeGetCountersâ€™<br />
PVRScope.h:106: error: expected â€˜=â€™, â€˜,â€™, â€˜;â€™, â€˜asmâ€™ or â€˜ __attribute__ â€™ before â€˜PVRScopeReadCountersThenSetGroupâ€™<br />
PVRScope.h:141: error: expected specifier-qualifier-list before â€˜ESPSCommsLibTypeâ€™<br />
PVRScope.h:166: error: expected â€˜=â€™, â€˜,â€™, â€˜;â€™, â€˜asmâ€™ or â€˜ __attribute__ â€™ before â€˜*â€™ token<br />
PVRScope.h:169: error: expected â€˜)â€™ before â€˜*â€™ token<br />
PVRScope.h:173: error: expected â€˜)â€™ before â€˜&â€™ token<br />
PVRScope.h:181: error: expected â€˜=â€™, â€˜,â€™, â€˜;â€™, â€˜asmâ€™ or â€˜ __attribute__ â€™ before â€˜pplSendMarkâ€™<br />
PVRScope.h:187: error: expected â€˜=â€™, â€˜,â€™, â€˜;â€™, â€˜asmâ€™ or â€˜ __attribute__ â€™ before â€˜pplLibraryCreateâ€™<br />
PVRScope.h:196: error: expected â€˜=â€™, â€˜,â€™, â€˜;â€™, â€˜asmâ€™ or â€˜ __attribute__ â€™ before â€˜pplLibraryDirtyGetFirstâ€™<br />
PVRScope.h:203: error: expected â€˜=â€™, â€˜,â€™, â€˜;â€™, â€˜asmâ€™ or â€˜ __attribute__ â€™ before â€˜pplCountersCreateâ€™<br />
PVRScope.h:212: error: expected â€˜=â€™, â€˜,â€™, â€˜;â€™, â€˜asmâ€™ or â€˜ __attribute__ â€™ before â€˜pplCountersUpdateâ€™<br />
pvrtest.c: In function â€˜mainâ€™:<br />
pvrtest.c:7: error: â€˜SPVRScopeImplDataâ€™ undeclared (first use in this function)<br />
pvrtest.c:7: error: (Each undeclared identifier is reported only once<br />
pvrtest.c:7: error: for each function it appears in.)<br />
pvrtest.c:7: error: â€˜scopeDataâ€™ undeclared (first use in this function)<br />
pvrtest.c:9: error: expected â€˜=â€™, â€˜,â€™, â€˜;â€™, â€˜asmâ€™ or â€˜ __attribute__ â€™ before â€˜returnCodeâ€™<br />
pvrtest.c:9: error: â€˜returnCodeâ€™ undeclared (first use in this function)<br />
pvrtest.c:17: error: â€˜SPVRScopeCounterDefâ€™ undeclared (first use in this function)<br />
pvrtest.c:17: error: â€˜counterArrayâ€™ undeclared (first use in this function)<br />
pvrtest.c:19: error: â€˜SPVRScopeCounterReadingâ€™ undeclared (first use in this function)<br />
pvrtest.c:19: error: expected â€˜;â€™ before â€˜counterReadingsâ€™<br />
pvrtest.c:23: error: â€˜counterReadingsâ€™ undeclared (first use in this function)</font>
```<pre>My os is 64-bit Ubuntu 10.10. Since the code is exactly copied from offical user manual, i don't know what's wrong with it. Any help will be greatly appreciated. </pre></div>
````

---

<div class="post-metadata">

**Author:** ![JoeDavis](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.imgtec.com/joedavis/32/71_2.png) [@JoeDavis](https://forums.imgtec.com/u/JoeDavis)\
**Post date:** [July 2, 2012, 10:32am UTC](https://forums.imgtec.com/t/pvrscope-example-code-seems-doesnt-work/1457/2 "2012-07-02T10:32:50Z")

</div>

Hi,  
It is a known bug that the code in this manual is broken. You should instead use the source from the PVRScope examples as a starting point for your implementation of this API.  
  
Regards,  
Joe
