Unable to generate c++ projects file 4.9

Starting a new thread because I haven’t found a solution yet,was on this thread Unable to generate c++ projects file 4.9 *Found Fix* - Programming & Scripting - Epic Developer Community Forums
was doing a good job helping me out

Problem:
When I try to create any project with C++ code it give this error : UnrealBuildTool Exception: ERROR: Failed to harvest environment variables

I’ve already tried looking at the paths for the quotes.Running not 8. I’ve reinstalled both unreal and visual studio, and verified it, still the same error. From 4.8.3 and back, it works

Hey -

Can you try reinstalling the Windows SDK to see if that helps: http://www.microsoft.com/en-us/download/details.aspx?id=8279

You may also want to check your environment variables settings as described in the last post of this thread: ERROR: Failed to harvest environment variables - C++ - Epic Developer Community Forums

Cheers

Tried the sdk reinstall no luck, reinstalled .net too. variables are good from what I can see, I’ve checked quite a few times. I can upload them if you want. Any other ideas on what might be the issue?

Are you using the the binary engine from the Launcher or a source built version of the engine? If you’re using the engine from source can you try to merge in this commit to see if helps with create code projects:

https://github.com/EpicGames/UnrealEngine/commit/f7528b69d25b5258626aabb6b6e70ce715dc40ef

EDIT:
Another thing to check would be to make sure that there are no spaces in the file path where the engine version is located. Try removing any spaces in the folder names for the engine location and try again.

I’m using the launcher, path C:\Program Files\Unreal Engine\4.9, cant change program files I can change the unreal engine to have no space but that seems like it broke more than it fixed, should I move unreal engine so I could change the path?

not exactly an image but should the trick link text, and yes to the second question, I can put the code in but i cant build to anything after that, and correct I cant create C++ projects.

Can you post a screenshot of your environment variables? Just to clarify, you get this error when adding code to a project as well as when trying to create a new C++ project, correct?

im currently working on 4.9.2 I thought I almost had it but threw a similar error about building it then it sent me to visual studio to build it, Visual studio said I needed .net 4.5.1 to build it so I got that and it reverted back to the original failed to harvest error

Hi ,

We are a little bit stumped with regards to why this issue is persisting for you. Everything we have checked so far looks like it is ok, so there is likely some relatively small detail that we have overlooked. A couple more things to look at as more of a sanity check than anything else.

First, could you list the folders you have at the following location: C:\Program Files (x86)\Microsoft SDKs\Windows

There will likely be more than one. For reference, I have 7 folders: v7.0A, v7.1A, v8.0, v8.0A, v8.1, v8.1A, and v10.0A. The SDK’s don’t correspond to the version of Windows you have installed, but rather allow you to develop projects that can be used on different versions of Windows.

Second, could you please go to Control Panel\Programs\Programs and Features and check what .NET Frameworks you have installed? Again, you are likely to have more than one installation. This is what I have currently (The 4.5.2 and 4.6 installations were added when I installed VS 2015):

SDKs folder

.net installs

Hey -

We’re still looking into this problem but have not been able to find a solution yet. Are you receiving the error about “Failed to harvest environment variables” inside Visual Studio or is this a prompt you’re receiving through the project browser when creating the project? Have you tried creating a project in a folder other than the default location given when creating a new project? Additionally, are you using the Launcher or the Binary version of the engine? If you have a GitHub account, can you try downloading the Release branch and let me know if you have the same issue creating a code project?

I’m having this issue too; the error is an unreal engine window called “create project” that says “An error occured while trying to generate project files”

It ends with “UnrealBuildTool Exception: ERROR: Failed to harvest environment variables”

x64

Hey Mercury00-

Have you tried either of the solutions mentioned in the post linked in the first post above? If you’re still unable to create a code project after trying those solutions please respond here with any update.

its through the project browser when creating the project, tried creating the project in a different spot same error occurred, using the launcher, i’ll try the release version from github to see if that’ll work and post back here with the results.

Update, Tried to build a project with the release branch from github and the same error occurred

release branch failed to build the project also

Are you using Visual Studio 2013 or 2015? Are you able to create other projects inside VS? Can you also post the full error message you receive when trying to create a project (screenshot would work)?

Yes, tried both: combed through my environment variables. Sanitized them all (though honestly, if a quote or such was a problem, that’s a problem with not sanitizing input with the program, not my environment variables). Reinstall SDKs. I’m not running from source, I’m using the prebuilt binaries. Running the program that creates xml file of environment variables on the command line directly completes just fine and outputs a file that looks like perfectly good xml.

I just ran the entire unreal editor as an administrator, a suggestion from a previous thread with this problem. Just this moment, doing so allowed me to create a new project without the crash about failing to harvest environment variables. FYI. Maybe a short term solution, since I seem to be able to /load/ c++ projects, just not create them. However, I haven’t yet tried building. Also, it launches VS 2013, not VS 2015, but that’s a totally different issue.

Just to make sure I understand correctly, running the editor as admin allows you to create a code project but opens in VS2013? When not in admin mode (and getting the environment variables error) does it try to open 2015 or 2013?