The code in getVisualStudioDir changes the string returned by getenv, and this is forbidden. Any subsequent call to getenv returns the modified string.<div><br></div><div>I've changed the code to initialize path using the string range constructor (pointer returned by strstr is used like an end iterator) instead of null terminating the string returned by getenv. I've also removed the const_cast.</div>