Walnut icon indicating copy to clipboard operation
Walnut copied to clipboard

Cannot open include file: 'vulkan/vulkan.h': No such file or directory

Open KnutssonDevelopment opened this issue 2 years ago • 14 comments

When trying to compile. I am getting this error: Cannot open include file: 'vulkan/vulkan.h': No such file or directory

Is something missing, or is there some dependency I am missing?

KnutssonDevelopment avatar Feb 05 '23 22:02 KnutssonDevelopment

You need the Vulkan SDK installed, as listed in Requirements on Walnut page.

Then add the path to the project properties in Visual Studio: project > properties > c/c++ > general > additional include directories for example, C:\VulkanSDK\1.1.130.0\Include

greenkalx avatar Feb 05 '23 23:02 greenkalx

i have a similar issue while compiling OpenGothic, but i dont really understand your answer, some help maybe? O:)

Roever1 avatar Jun 06 '23 17:06 Roever1

Which part do you not understand? Where did you install the Vulkan SDK? Where did you provide the include path in Visual Studio? Is there an error when compiling?

greenkalx avatar Jun 07 '23 05:06 greenkalx

my issue is solved, Vulkan was not properly installed. thanks anyway :)

Roever1 avatar Jun 07 '23 07:06 Roever1

Hey guys, I'm also facing the same issue. I have installed the Vulkan SDK dependency and added the path to the .h files to the Additional Include Directories in Project settings. But unfortunately it does not seem to work. Help would be appreciated, thanks.

Assault-OPS avatar Jul 30 '23 03:07 Assault-OPS

Hey guys, I'm also facing the same issue. I have installed the Vulkan SDK dependency and added the path to the .h files to the Additional Include Directories in Project settings. But unfortunately it does not seem to work. Help would be appreciated, thanks.

Same issue here

BrenoBDias avatar Aug 16 '23 03:08 BrenoBDias

@Assault-OPS @BrenoBDias You shouldn't manually add the path to the headers in project settings, those will get overridden by Premake, the originals are defined in the .lua files.

The installation of the Vulkan SDK should add a system-wide environment variable called "VULKAN_SDK", which is used by Premake for includes.

Windows tends to not properly resolve new environment variables, without a reboot, so try that after the Vulkan installation.

flyingpie avatar Sep 24 '23 22:09 flyingpie

Windows tends to not properly resolve new environment variables, without a reboot, so try that after the Vulkan installation.

Because it doesn't resolve environment variables.. you have to reset the environment.. if linux does resolve that is just a feature of it... linux will also damage or wear out your equipment in exchange for the quickness also.

This is why I don't use premake, reading random lua files for mystery dependancies... do everything manually and you'll always know how it's meant to be included.

Acromatic avatar Oct 03 '23 16:10 Acromatic

Hi, it worked for me adding, the "include" folder using the General section, and adding the lib path and a lib reference itself in the "linker" section. This tiny video helped me: Add External Include Folders and Libraries to C/C++ Projects using Visual Studio 2022 After setting all this I'm able to build and run the "WalnutApp", also, for me, the "setup.bat" script from the "scripts" folder worked like a charm.

I'm on Win 10 with VS 2022

garrigueta avatar Dec 11 '23 06:12 garrigueta

Hi, it worked for me adding, the "include" folder using the General section, and adding the lib path and a lib reference itself in the "linker" section. This tiny video helped me: Add External Include Folders and Libraries to C/C++ Projects using Visual Studio 2022 After setting all this I'm able to build and run the "WalnutApp", also, for me, the "setup.bat" script from the "scripts" folder worked like a charm.

I'm on Win 10 with VS 2022

Yes, you need the include directive, and the lib, AND the dependency linker name as an example vulkan-1.lib... you'll also need the windows versions vulkan-1.lib imgui.lib glfw3.lib gdi32.lib user32.lib shell32.lib kernel32.lib advapi32.lib

If not mistaken these are the ones used by walnut, they are from my other project though so that might change for someone else. Also different on other Operating Systems. The batch script runs a premake binary executable that rewrites the vs project files... I mention this because it's important to learn how to edit them manually as well. you can also use vs->project settings and add them all that way. under the C/C++ General/Linker General and Linker Input sections.

You may find yourself wondering how to acquire those, aside from being written into those libraries, they're also attached to whatever functions they possess, so look them up by function and when that doesn't work you just include all the names that are inside the lib folder, those are your dependecies.

Acromatic avatar Dec 13 '23 13:12 Acromatic

@Assault-OPS @BrenoBDias You shouldn't manually add the path to the headers in project settings, those will get overridden by Premake, the originals are defined in the .lua files.

The installation of the Vulkan SDK should add a system-wide environment variable called "VULKAN_SDK", which is used by Premake for includes.

Windows tends to not properly resolve new environment variables, without a reboot, so try that after the Vulkan installation.

It resolves it perfectly fine, but only from explorer. So any cmd.exe that you have open, you need to re-open from explorer (and not some custom launcher)

learn-more avatar Dec 17 '23 21:12 learn-more

need to add %VULKAN_SDK%\Include to your additional directories path. Even if Vulkan is installed correctly, the project file won't fine the vulkan headers. I'm not sure how to add that to the project file/sln builder, otherwise I'd do a PR.

Daneaux avatar Mar 05 '24 02:03 Daneaux

need to add %VULKAN_SDK%\Include to your additional directories path. Even if Vulkan is installed correctly, the project file won't fine the vulkan headers. I'm not sure how to add that to the project file/sln builder, otherwise I'd do a PR.

No need to do a PR for something that is already present.

learn-more avatar Mar 05 '24 07:03 learn-more

I had this same symptom and I'm writing to describe my solution.

I did all of these steps, before installing the Vulkan SDK, which is obviously not going to work:

  1. run Setup.bat
  2. open the solution in visual studio
  3. compile the application; obviously here is where I ran into the problem.

I installed Vulkan SDK and rebooted, and at this point, even adding the correct include directory in the Project settings did not let the compiler find vulkan/vulkan.h, which I don't understand!

So Walnut still wouldn't compile. I believe this is because vendor\bin\premake5.exe looks for Vulkan SDK and sets things up to match the installed location etc. etc. Who knows. But my theory is that if premake5 didn't find the Vulkan SDK, then the project never finds the Vulkan headers. So here are the steps I took to get going again.

  1. look in .gitignore you'll see what files to delete. This includes the .vcxproj file(s), WalnutApp.sln, bin and bin-int, and probably .vs.
  2. Rerun Setup.bat; this will regenerate the files you just deleted
  3. open the solution in Visual Studio
  4. build the application, this time successfully

Hopefully this information helps someone else out there

omarandlorraine avatar Apr 04 '24 08:04 omarandlorraine