How do you make your IDE understand Blender's file management?

When writing Blender source code I’m constantly running into the issue that the Visual Studio IDE doesn’t understand Blender’s file management. Let me illustrate the problem:

svm_mapping.h:

void foo ()
{
      float3 bar;//Doesn't include the necessary libraries for class float3
      //some code
}

svm.h:

#include "float3_library"
#include "svm_mapping"

//some code

Let’s say I work in svm_mapping.h. It defines functions which use library classes and function but doesn’t include them because it itself is included in svm.h which has the necessary libraries included.

The problem is that when working in svm_mapping.h Visual Studio doesn’t “see” the library for the float3 class as it understand that the file that includes it has the necessary libraries included, which causes it to give a ton of missing declaration error in the IDE, making my whole file basically a sea of red.

With larger files I literally get hundreds of false positives which completely drowns my Error List, meaning that if I do have a real error I have to search it in the build output which due to the amount of files that are compiled every time is also easier said than done.

So to all developers of Blender: How did you solve this problem?

The way cycles is setup there’s really no way around that, many types/functions are just not known when you are editing a header in isolation, things will only take their true form through the compilation of kernel_xxxx.cpp and that confuses at least with MSVC the IDE quite a bit.

However If you use visual studio it’s easy to sidestep, put this little guy to “Build Only” to only actually see errors/warns coming out of a build and not everything the IDE thinks is wrong

image

2 Likes

It works, @LazyDodo comes to the rescue again! Thank you!