Compiling PVRTools as part of project


I recently posted a question regarding packaging up the PVRTools code. I am currently attempting to compile my project with the pvrtools source files in a subdirectory under my main source tree.

I’m getting the following error in the PVRTShader.cpp file:

"Assigning to ‘const char*’ from incompatible type ‘char’"

The error relates to a line in this method:

EPVRTError PVRTShaderLoadSourceFromMemory(

const char* pszShaderCode,

const GLenum Type,

GLuint* const pObject,

CPVRTString* const pReturnError,

const char* const* aszDefineArray, GLuint uiDefArraySize)

it’s the last line in the else block below: pszShaderCode = ‘’;

if(strncmp(tmp, “version”, 7) == 0)


const char* c = strchr(pszShaderCode, ‘n’);



size_t length = c - pszShaderCode + 1;

pszShaderString = CPVRTString(pszShaderCode, length);

pszShaderCode += length;




pszShaderString = CPVRTString(pszShaderCode) + “n”;

pszShaderCode = ‘’;



is this right? shouldn’t this be pszShaderCode = “” ?

Using the double quote removes the error, but is it what was intended?

Not sure why I’m getting this error now. My project is compiled with C++11 enabled so are there stricter type checks going on?



Hi Andre,

Thanks for reporting the issue. It seems that this code is incorrectly trying to assign ‘’ to the pointer instead of the data it points to. I’ve filed BRN48510 in our bug tracker. the issue will be fixed in a future release.

You should be able to solve the issue by dereferencing the pointer before assigning the value:

*pszShaderCode = ‘’;



Hi Joe,

Yeah, that puzzled me too. I did think about doing the dereference as you suggest, but pszShaderCode is a pointer to const char so I can’t :frowning:

Not sure how this method is supposed to work, I can’t really see why that line is needed.

I’ve commented the line out for now. It all still works on my end.

It looks like the line only gets executed in shaders that have a version number at the top, and are all on one line without a newline character at the end.

If this else block is executed, then what the method goes on to do next is probably incorrect:

it appends a series of #defines to what would now be the end of the shader, then copies all the shader code again:

pszShaderString += pszShaderCode;

Looks like the best thing would be if that whole else block just disappeared! :slight_smile:

Kind Regards,


Ah - yeah. You’re right. I shouldn’t have skim read…

Removing that code seems sensible, as it wasn’t doing anything anyway and hasn’t caused any problems for you. We’ll make sure this code is re factored for a future release.