HISE Logo Forum
    • Categories
    • Register
    • Login

    Issue creating a c++ script fx node with multiples .h files

    Scheduled Pinned Locked Moved Scripting
    15 Posts 3 Posters 107 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • P
      Papours @HISEnberg
      last edited by

      @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 and TestFilter::Test t(0.5); in prepare

      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

      P 1 Reply Last reply Reply Quote 0
      • P
        Papours @Papours
        last edited by

        @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 ?

        ustkU P 3 Replies Last reply Reply Quote 0
        • ustkU
          ustk @Papours
          last edited by

          @Papours would it make a difference if you use

          #include <test_filter.h>
          

          in the cpp instead of

          #include "test_filter.h"
          

          Hise made me an F5 dude, browser just suffers...

          1 Reply Last reply Reply Quote 0
          • ustkU
            ustk @Papours
            last edited by ustk

            @Papours You might also need to set the search path for src in 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...

            Hise made me an F5 dude, browser just suffers...

            1 Reply Last reply Reply Quote 0
            • P
              Papours @Papours
              last edited by

              @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.

              P 1 Reply Last reply Reply Quote 0
              • P
                Papours @Papours
                last edited by

                @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 alt text.

                However, when exporting my hise project, it tried to re-build everything and fail :(

                HISEnbergH P 2 Replies Last reply Reply Quote 0
                • HISEnbergH
                  HISEnberg @Papours
                  last edited by

                  @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....

                  Sonic Architect && Software Mercenary

                  1 Reply Last reply Reply Quote 0
                  • P
                    Papours @Papours
                    last edited by

                    @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
                    alt text

                    I don't think the issue is with the #include since I can build my project from visual studio code

                    HISEnbergH 1 Reply Last reply Reply Quote 0
                    • HISEnbergH
                      HISEnberg @Papours
                      last edited by

                      @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.

                      Sonic Architect && Software Mercenary

                      P 1 Reply Last reply Reply Quote 0
                      • P
                        Papours @HISEnberg
                        last edited by

                        @HISEnberg

                        When launching the project directly from there, I get the same linker 2019 error as from when launching from dspNetwork.

                        alt text

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

                        alt text

                        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.

                        P 1 Reply Last reply Reply Quote 0
                        • P
                          Papours @Papours
                          last edited by

                          @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 !

                          P 1 Reply Last reply Reply Quote 0
                          • P
                            Papours @Papours
                            last edited by

                            @Papours alt text

                            And I was able to import it into lmms !

                            Many thanks !

                            HISEnbergH 1 Reply Last reply Reply Quote 0
                            • HISEnbergH
                              HISEnberg @Papours
                              last edited by

                              @Papours Nice glad you solved this!

                              Sonic Architect && Software Mercenary

                              1 Reply Last reply Reply Quote 0
                              • First post
                                Last post

                              26

                              Online

                              2.0k

                              Users

                              12.9k

                              Topics

                              111.5k

                              Posts