#Installed SDK on custom directory, but it still includes headers from `/usr/include` , why ?

121 messages Β· Page 1 of 1 (latest)

rigid canopy
#

after reboot, terminal sees those variables , those are correct variables I think I followed docs

sage patio
#

How are you building the project?

rigid canopy
#

with vscode/cmake

sage patio
#

post code

#

/usr/include is a default search path for include files, and so if you are using find_package(Vulkan) it may be picking them up from there.

rigid canopy
#
cmake_minimum_required(VERSION 3.29)
project(TEST1 VERSION 0.1.0 LANGUAGES C CXX)

find_package(Vulkan REQUIRED)

add_executable(Main "main.cpp")
target_link_libraries(Main PRIVATE Vulkan::Vulkan)```
#

as simple as that

#

then what's the point of include dirs of SDK if it will read from usr/include anyway

sage patio
#

im not sure what you mean

rigid canopy
#

should I set include variable there in /etc/enviroment too ?

#

I want headers from sdk directory not from /usr/include

sage patio
#

Okay, did you clean out your cache before re-runnning cmake?

rigid canopy
#

yes 10 times

#

it sees correct paths by the way

#

take a look a sec

sage patio
#

and you are sure VULKAN_SDK is set in the environment you are running cmake in?

rigid canopy
#

will check that , with $ENV .. a sec

#
message("TEST: " $ENV{VULKAN_SDK})
#

correct ?

sage patio
#

yeah

rigid canopy
sage patio
#

well thats good

rigid canopy
#

here is print

#
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/mnt/b1b56d51-33ac-4613-a905-03b004de143d/VulkanSDK/1.3.283.0/x86_64/bin"
VULKAN_SDK="/mnt/b1b56d51-33ac-4613-a905-03b004de143d/VulkanSDK/1.3.283.0/x86_64"
LD_LIBRARY_PATH="/mnt/b1b56d51-33ac-4613-a905-03b004de143d/VulkanSDK/1.3.283.0/x86_64/lib"
VK_LAYER_PATH="/mnt/b1b56d51-33ac-4613-a905-03b004de143d/VulkanSDK/1.3.283.0/x86_64/share/vulkan/explicit_layer.d"
VK_ADD_LAYER_PATH="/mnt/b1b56d51-33ac-4613-a905-03b004de143d/VulkanSDK/1.3.283.0/x86_64/share/vulkan/explicit_layer.d"```
#

here I just don't see INCLUDE dir variable

#

shoudn't it be there ?

sage patio
#

FYI you do have /usr/<bin> in your path ahead of the VULKAN_SDK path

sage patio
#

can you post your full cmake configure log?

rigid canopy
#

yes I have /mnt/b1b56d51-33ac-4613-a905-03b004de143d/VulkanSDK/1.3.283.0/x86_64/bin bin here so when I'm doing find_package() it will search include dirs from what's written in FindVulkan.cmake right ?

#

where can I find that log ?

#

will post ofc

sage patio
#

yes, in a general sense (it doesn't use /bin directly in the FindVulkan.cmake, it just uses VULKAN_SDK/include)

#

uhhhh generally in your build folder

rigid canopy
#

ninja_log ?

#

this is build dir

rigid canopy
sage patio
#

It'll be in the CMakeFiles then

rigid canopy
#

which one ?

sage patio
#

ninja_log isn't useful, thats after you configured cmake. CMakeCache.txt would be useful

rigid canopy
#

this is from build dir

#

and I cleaned that really many times

sage patio
#

well your cache says you have the right include path

//Path to a file.
Vulkan_INCLUDE_DIR:PATH=/mnt/b1b56d51-33ac-4613-a905-03b004de143d/VulkanSDK/1.3.283.0/x86_64/include
rigid canopy
#

correct , I knew that by printing that variable after find_package populates vartiables

#

what's the issue ? 😦

sage patio
#

okay I do not see the log from cmake where I thought I would.

rigid canopy
#

included from /usr/include

sage patio
#

Oh how are you "getting" to vulkan.h? Just hitting f12?

rigid canopy
#

ctrl mouse click

#

or I'm just opening in explorer the header included

sage patio
#

you might be getting what "intellisense" is using rather than what the compiler is getting

#

if you delete your cache and reconfigure, the 'log' is printed to the vscode console. can you copy that?

rigid canopy
#

another very strange thing what happens here , maybe that will be hint on what's going on

#

it sees vulkan includes even without clean project

#

not need to ask for vulkan

south saddle
#

are you using the vs code cmake plugin?

rigid canopy
#

yes

#

maybe switch to release version ?

south saddle
#

Do you have a "c_cpp_properties.json" in your project?

#

That might override the include directories

rigid canopy
#

no I don't

south saddle
#

also check for a settings.json

#

they're usually in the (sometimes hidden) .vscode folder

rigid canopy
#

I don't havethem too , I don't have .vscode dir there at all

fast walrus
#

intelisense is provided by a separate plugin, that plugin did not use the cmake plugin to detect the paths

rigid canopy
#

#include <vulkan/vulkan.h> is possbile without find_package(Vulkan REQUIRED)

#

how ?

sage patio
#

I see that compile_commands.json was generated, which is a good sign

rigid canopy
#

think that is intellisense ?

sage patio
#

I think so - I sometimes am bit by intellisense and cmake not matching

fast walrus
#

compile_commands.json is a clangd file so it would only work with clangd intelisense not the standard cpp intelisense from microsoft

rigid canopy
#

you can't just #include <vulkan/vulkan.h>

#

in empty project, but now I can ..

fast walrus
#

I mean afaik πŸ˜‚

south saddle
#

If you can include in a new empty project, you probably have a global include path settings (file) setup

rigid canopy
#

which I didn't craete, in other words something happened and now I can't get to default state 😦 ...

sage patio
fast walrus
#

ohhhhh

south saddle
#

Can you check the C_Cpp.default.includePath setting in vscode?

rigid canopy
#

ofc , a sec

south saddle
#

you migth have setup include paths for your user

fast walrus
#

@rigid canopy

A custom configuration provider is another extension in VS Code that can potentially provide more accurate C++ IntelliSense configuration than the C/C++ extension.

To add an extension as a configuration provider, either select the extension through the configuration Quick Pick, add it to configuration UI by editing the Configuration provider field under Advanced Settings, or add the configurationProvider field to your c_cpp_properties.json file. For example, for the CMake extension, the path to add would be ms-vscode.cmake-tools.

rigid canopy
#

nope

south saddle
#

And C_Cpp.default.systemIncludePath ?

rigid canopy
#

nope

#
cmake_minimum_required(VERSION 3.29)
project(TEST2 VERSION 0.1.0 LANGUAGES C CXX)

add_executable(TEST2 main.cpp)
``` clean project new directory
#

πŸ˜„

#

but not funny .. it's easier to set off the rocket I guess

#

I have cockroach entry somewhere that refuses to wipe itself from list

#

I didn't included anything .. really

#

that started after I added variables

#

and I'm also able to create VkInstance

#
    VkInstance i{};
sage patio
#

what

rigid canopy
#

afaik I need a libs for that ... no ?

sage patio
#

no

#

all you did was declare a pointer

#

creating an instance requires calling vkCreateInstance, otherwise its not different than Foo* foo {};

rigid canopy
#

hmm ok got that .. anyway thanks for help . will dig further dunno what's the binary evil is going on here πŸ™‚

#
    VkApplicationInfo AppInfo{};
    AppInfo.apiVersion = VK_API_VERSION_1_3;```
#

that isn't pointer but possbile too

sage patio
#

yeah, VkApplicationInfo is just a struct

#

and VkInstance is a 'dispatchable handle' which akin to a uint64_t value (but it is a pointer, just to an opaque type)

#

When you say "create an instance" you are meaning "creating a Vulkan Instance Object" which requires calling Vulkan API calls which perform the necessary internal logic to create an instance. You get access to that instance from the VkInstance handle that is returned from vkCreateInstance (well, out parameter). Hence why you can't just create an instance with VkInstance instance{};

rigid canopy
#

yes I was not be able to pass this ```cpp
VkInstance I;

int main(int, char**)
{

VkInstance i{};
VkApplicationInfo AppInfo{};
AppInfo.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
AppInfo.apiVersion = VK_API_VERSION_1_3;

VkInstanceCreateInfo InstanceC{};
InstanceC.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
InstanceC.pApplicationInfo = &AppInfo;


auto x = vkCreateInstance(&InstanceC, nullptr, &I);
if (x != VK_SUCCESS)
{
    
}

}``` I just panicing maybe it also links the libs some hidden way πŸ™‚

#

but looks like it only includes from somewhere ...