# Issue with PVRTexLib (class CPVRTextureHeader)

**URL:** <https://forums.imgtec.com/t/issue-with-pvrtexlib-class-cpvrtextureheader/322>\
**Category:** PowerVR Insider\
**Created:** [April 10, 2009, 1:07pm UTC](https://forums.imgtec.com/t/issue-with-pvrtexlib-class-cpvrtextureheader/322 "2009-04-10T13:07:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![pascal29](https://avatars.discourse-cdn.com/v4/letter/p/db5fbb/32.png) [@pascal29](https://forums.imgtec.com/u/pascal29)\
**Post date:** [April 10, 2009, 1:07pm UTC](https://forums.imgtec.com/t/issue-with-pvrtexlib-class-cpvrtextureheader/322/1 "2009-04-10T13:07:09Z")

</div>

Hello,

  

I have an issue with the use of PVRTexLib, more precisely with the constructor of the class CPVRTextureHeader. I'm using Visual Studio 2003, i've installed PVRTexLib.dll, include headers, define \_WINDLL\_IMPORT as described in the manual.

  

I can use CPVRTexture class, i don't have problem, so, for me, i've well installed the library.&nbsp;&nbsp;But i can't create an instance of the CPVRTextureHeader, the application compiles but i obtain a microsoft error during the creation of the "\*.exe" (" "\*.exe" has encountered a problem and must close ...")
  

&nbsp;
  

Here is the code : 
  

&nbsp;
  

////////////////////////////////
  

// TestEncodeIntoPVR
  

////////////////////////////////
  

#include \<iostream\>

  

using namespace std;

  

#define \_WINDLL\_IMPORT 1

  

#include "Include/PVRTexLib.h"

  

using namespace pvrtexlib;

  

const char g\_TexFilePVR[] = "Picture/Mallet.pvr";

  

  

int main()

  

{

  

  

PVRTRY

  

{

  

  

FILE\* p\_pvrFile = fopen(g\_TexFilePVR, "rb");

  

CPVRTextureHeader\* p\_textureHeader = NULL;

  

if (p\_pvrFile != NULL)

  

{

  

// issue with CPVRTextureHeader constructor

  

p\_textureHeader = new CPVRTextureHeader(p\_pvrFile);

  

}

  

}

  

PVRCATCH(myException)

  

{

  

printf("Exception : %s",myException.what());

  

}

  

&nbsp;

  

return 0;

  

}

  

//// end TestEncodeIntoPVR  

  

  

  

If you have a solution, i'll be happy :-)  

  

Thank you.

---

<div class="post-metadata">

**Author:** ![GordonMaclachlan](https://avatars.discourse-cdn.com/v4/letter/g/c68b51/32.png) [@GordonMaclachlan](https://forums.imgtec.com/u/GordonMaclachlan)\
**Post date:** [April 14, 2009, 10:31am UTC](https://forums.imgtec.com/t/issue-with-pvrtexlib-class-cpvrtextureheader/322/2 "2009-04-14T10:31:26Z")

</div>

I’m not entirely sure what is happening here - I can’t immediately see anything wrong with what you are doing.  
  
  
  
  
  
I’ve filed a bug (BRN27065) and will report back when I know more.

---

<div class="post-metadata">

**Author:** ![pascal29](https://avatars.discourse-cdn.com/v4/letter/p/db5fbb/32.png) [@pascal29](https://forums.imgtec.com/u/pascal29)\
**Post date:** [April 14, 2009, 11:18am UTC](https://forums.imgtec.com/t/issue-with-pvrtexlib-class-cpvrtextureheader/322/3 "2009-04-14T11:18:15Z")

</div>

Thank you for your reply.

&nbsp;
  

Just to summarize, it's an issue with the constructor of CPVRTextureHeader class, more precisely : 
  

CPVRTextureHeader(FILE \*const fFile);

  

  

Make my test with Visual Studio, you'll see the result. Perhaps, it's a problem with the implementation of this constructor, it's a FILE \*const fFile. In the implementation of this constructor, you may have modified the value of the pointer fFile which must stay constant.
  

&nbsp;

---

<div class="post-metadata">

**Author:** ![tobias](https://avatars.discourse-cdn.com/v4/letter/t/c67d28/32.png) [@tobias](https://forums.imgtec.com/u/tobias)\
**Post date:** [November 16, 2010, 4:05pm UTC](https://forums.imgtec.com/t/issue-with-pvrtexlib-class-cpvrtextureheader/322/4 "2010-11-16T16:05:34Z")

</div>

Hi pascal,  
  
  
  
  
  
Not sure if you’re still around, and I’m sorry this has taken so long, but I’ve now taken over this bug and have tested the problem in the current SDK (2.7) and found it not to be an issue. If you have any other queries or find this problem still appears for you with the latest SDK release please don’t hesitate to reply.  
  
  
  
  
  
Thanks!
