Hi all,<br><br>I'm having a problem with the vtk error macro, and was hoping someone could shed some light on the issue.<br><br>The relevant lines for this problem start on line 467 of vtkGetSet.h from the git head:<br>
<br> vtkmsg << "ERROR: In " __FILE__ ", line " << __LINE__ \<br> << "\n" << self->GetClassName() << " (" << self \<br>
<< "): " x << "\n\n"; \<br><br>If x is a std::string, the above fails to compile, but the following is fine:<br><br> vtkmsg << "ERROR: In " __FILE__ ", line " << __LINE__ \<br>
<< "\n" << self->GetClassName() << " (" << self \<br> << "): " << x << "\n\n"; \<br>
<br>Note the extra << right before x.<br><br>I'm doing this to debug a problem in the vtkGDCMImageReader I'm having where images aren't being read in Java, but are read just fine in C++-- I think that there's a problem with string termination, but I don't know. So, I want to add the filename to the debug message.<br>
<br>The lines in gdcm are:<br><br> if( !reader.Read() )<br> {<br> //added more detail for those instances where you can't debug, like in java<br> std::string theFilename(filename);<br> std::string theError = "ImageReader failed on file: " + theFilename;<br>
vtkErrorMacro( theError );<br> return 0;<br> }<br><br>and they were:<br><br> if( !reader.Read() )<br> {<br> vtkErrorMacro( "ImageReader failed" );<br> return 0;<br> }<br><br>I don't want to change vtk at all, I want to use what exists. I could just modify my version right now to make my error message work (or at least compile)-- but how should I use the warning/error macros to get more information out than just a pure const char*? I tried to use theError.c_str(), but that also failed. It also failed to compile if I just sent filename over directly, as in vtkErrorMacro(filename);<br>
<br>Thanks,<br>Mark<br><br>