I want to use a char * with #pragma message to tell where my problems are in the Visual Studio debugger.
void OutputShaderErrors(const char *filename)
{
std::string outputMessage = "Errors written to: ";
outputMessage += filename;
#pragma message(outputMessage.c_str())
}
The above block of code does work, but the following warning is given:
Warning 1 warning C4083: expected 'string'; found identifier 'outputMessage'
As the #
in #pragma
suggest, this is a feature of the preprocessor. You cannot call it at runtime. The code does not actually work, and the warning you see comes from your invalid use of #pragma
.
Since you are working with Visual Studio, you may find the OutputDebugMessage
function useful.