Issue creating a c++ script fx node with multiples .h files
-
@Papours If I am following you correctly, the Binaries folder is the wrong place to store any of your external C++ code. The binary gets rewritten often (each time you compile the FX within HISE), so this is going to lead to issues down the line.
So let's say you have a dependency file
filters.cppthat is included in your C++ node header (let's call itfilters.h). You can either create a a new folder or location for the filters.cpp, or even simpler is to place it in:ProjectName\DspNetworks\ThirdParty\src.After you do that delete the Binaries folder and recompile your FX nodes.
-
@HISEnberg Hi, thanks for the quick response !
My filter was indeed inside ProjectName\DspNetworks\ThirdParty\src and I had a reference to it in my node header.
I'm not sure if my first post was clear so here is a step by step to reproduce my issue :- Create a new hise project
- Create c++ third party node template
- Compile DPS node as dll
- Create a src folder in thirdParty
- Create test_filter.cpp and test_filter.h
// .cpp #include "test_filter.h" namespace TestFilter { Test::Test(float param){ test_float = param; } }/// .h namespace TestFilter { class Test { public: float test_float; Test(float param); }; }- Inside the template, add
#include "src/test_filter.h"at the beginning andTestFilter::Test t(0.5);inprepare
Now if I try to build inside visual studio code I get a linker error saying that it can't find the definition of my constructor.
If I add the dependency to test.h and test.cpp, it works, but only once, and if I retry to compile the dps network as dll I have to re-add the filters to my dependencies.And if I go back to hise and try to export as a standalone app, I have the linker error again.
I hope this make my issue more clear and sorry if it wasn't on my first message
-
@Papours If needed, here is a youtube video illustrating my issue.
In other words, my question is : how can I tell hise to include external c++ files to the generated visual studio project ?
-
@Papours would it make a difference if you use
#include <test_filter.h>in the cpp instead of
#include "test_filter.h" -
@Papours You might also need to set the search path for
srcin your VS project so it knows where to look for dependencies. I know it's the case in XCode but I don't know VS... -
@ustk Hi, thanks for the reply !
I tried a lot of different ways to import my file. I tried to change the quotes to "<" ">", I tried to add a "./" at the beginning and a mix of the two. Nothing changed my issue. I don't think the issue is with the way I include my file, since the c++ linter has no issues finding my file.I'm not sure what the equivalent of "search path" is for visual studio, but I tried to dig into the project settings and add the global path to my src folder everywhere I tought could be the equivalent.
So I added the path to my src in :- executable directory
- Include directory
- External include directory
- Reference directory
- Library directory
- Win RT directory
- Source directory
After adding my path everywere (but not adding the external file directly as i did in the video), I still had the linker error.
That being said, I don't think not having the error would have solver my issue, because I think the root of my problem is that hise is re-generating the visual studio project every time I trie to compile a dll, vst or standalone app, so I'm not sure if the solution is inside visual studio.
-
@Papours Another frustrating thing is that if I manually add my external dependency in vscode, then build as release, then open hise, in tool > Show DSP network DLL info, it says that my DLL is working fine
.However, when exporting my hise project, it tried to re-build everything and fail :(
-
@Papours Sorry I missed your reply.
Have you tried using an absolute instead of a relative path here:
#include "src/test_filter.h"I've noticed that VS can be kind of finicky about paths sometimes. So in this case for windows it will look like:
("C:\\path\\to\\file\\src\test_filter.h")This isn't an ideal solution but it might help solving if the compiler is failing to find the file or not....
-
@HISEnberg Hey, it's ok, you're answering pretty fast even when missing my reply ^^
I did try to use an absolute path, I still had the same issue : I can build the project inside visual studio after adding the .h and .cpp files manually, but can't export my project from hise

I don't think the issue is with the #include since I can build my project from visual studio code
-
@Papours Hmm maybe try running the HISE project directly in VS.
So go through this whole procedure, but instead of compiling the Standalone in HISE, go to Project Name/Binaries/Builds/VisualSudio2022 and launch the project directly from there.
You can get a lot more useful information from the compiler that way.
-
When launching the project directly from there, I get the same linker 2019 error as from when launching from dspNetwork.

If I add my external dependency directly (right click on the project > add > existing element), I can generate a standalone app from there

But then if I reopen hise and try to export my project as a vst (which is my final goal), I get the same linker error.
-
@Papours OH
However, if before opening the visual studio project in "project name/binaries/build" I try in hise to make a VST, the project there is trying to make a VST.
Doing the same dance of adding my external files and building from there do generate my VST.
So that solves my issue, thanks !
-
-
@Papours Nice glad you solved this!
