0

I was using visual studio 2008 with parallel studio xe2011 to do fortran code, sometimes I also use visual studio 2022 community version. I set the cmd prompt for ifort compiler in External Tools and put the directory of ifortvars.bat in arguments. They work well all the time.

I encountered the problem yesterday. When I opened the cmd prompt, it showed "WindowsSdkDir not found" and could not generate a .exe file. it happens for both my vs2008 and vs2022.

I tried several methods according to some essays online, but always no luck.

After all the trials, I found that: if I open the cmd prompt in vs2008 or vs2022 without opening a file (in a target directory), and then I redirect it to my target directory by command cd, it works as before without a "WindowsSdkDir not found" warning. If I open the file in my target directory and then open the cmd prompt, the warning shows and it fails to compile. It seems my visual studio can only find a "WindowsSdkDir" in its initial directory?

I already defined the environment variable "WindowsSdkDir" in my system. But when I tried to show all my environment variables by running "set" in the cmd prompt from my visual studio, I couldn't find it in the list even though I ran it as admin.

It seems I should find a way to help my visual studio find somewhat named "WindowsSdkDir". would you please give me any suggestions regarding this problem?

The warning when I open cmd

0

1 Answer 1

0

Click on start - under Visual Studio, there should be some kind of command prompt - on VS2019, it is called

x64 Native Tools Command Prompt

On VS2010 (under Visual Studio Tools) it is called

Visual Studio Command Prompt(2010)
Visual Studio x64 Win64 Command Prompt (2010)

On VS2010, it points to C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A

On VS2019, it points to C:\Program Files (x86)\Windows Kits\10. I don't know what it is called on VS2008 but it will be something similar

Edit

These directories contain

  • .net tools/xml files
  • headers/libraries for various Microsoft libraries (eg ws2_32 for the socket library)
  • tools for signing executables etc

Some of these libraries may be required as part of the Fortran build eg kernel32.lib, user32.lib etc, which is probably why no executable is being generated.

Sign up to request clarification or add additional context in comments.

2 Comments

What should the asker do with these directories?
thanks a lot. in my case it's C:\Program Files (x86)\Microsoft SDKs\Windows\v6.0A. Anyway, I reset my computer and reinstalled Visual Studio and everything is ok now.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.