'UnrealBuilTool.ModulesRules' does not contain a constructor that takes 0 arguments

Hello,

Mintchococookie has made a nice tutorial on the process to do your own Blueprint node… you can find the full explaination here:

https://wiki.unrealengine.com/Creati…S_2017_%26_UE4

But I get error ‘UnrealBuilTool.ModulesRules’ does not contain a constructor that takes 0 arguments

and also feew “minor” error deprecated ‘definitions’

So I made some change but with no luck…any help ? Thanks !!! :




using System;
using System.IO;
using UnrealBuildTool;

public class UE4Magic : ModuleRules
{    
  // convenience properties    

  private string ModulePath    
  {        
     get { return ModuleDirectory; }
  }      

  private string ThirdPartyPath
  {        
    get { return Path.GetFullPath(Path.Combine(ModulePath, "../../ThirdParty/")); }
   }

   // constructor

  public UE4Magic(TargetInfo Target) : base(Target)
  {
    PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;

    PublicDependencyModuleNames.AddRange(new string] { "Core", "CoreUObject", "Engine", "InputCore", "HeadMountedDisplay" });

    LoadYJMagicLib(Target);
  }      

  public bool LoadYJMagicLib(TargetInfo Target)
  {        
    bool isLibrarySupported = false;

     if ((Target.Platform == UnrealTargetPlatform.Win64) || (Target.Platform == UnrealTargetPlatform.Win32))
     {
       isLibrarySupported = true;

        string PlatformString = (Target.Platform == UnrealTargetPlatform.Win64) ? "x64" : "x86";
        string LibrariesPath = Path.Combine(ThirdPartyPath, "YJMagicLib", "Libraries");              

        /*             test your path with:
        using System; // Console.WriteLine("");
        Console.WriteLine("... LibrariesPath -> " + LibrariesPath);
        */

        PublicAdditionalLibraries.Add(Path.Combine(LibrariesPath, "YJMagicLib." + PlatformString + ".lib"));
      }

      if (isLibrarySupported)
        {            
           // Include path            
           PublicIncludePaths.Add(Path.Combine(ThirdPartyPath, "YJMagicLib", "Includes"));        
        }          

         PublicDefinitions.Add(string.Format("WITH_YJ_MAGIC_LIB_BINDING={0}", isLibrarySupported ? 1 : 0));
         return isLibrarySupported;    
   }
}





*.Build.cs ModuleRules different from UE version. Create example UE project and check difference.

Maybe UE 4.19 >=



public UE4Magic(TargetInfo Target) : base(Target)

-->

public UE4Magic(ReadOnlyTargetRules Target) : base(Target)


2 Likes

Hello

Thanks empty2fill ! in bold some change in the code and the line where a new error occure:

I get an CS1502 error on line LoadYJMagicLib(Target);




using System;
using System.IO;
using UnrealBuildTool;
**using System.Collections.Generic;**

public class UE4Magic : ModuleRules
{    
  // convenience properties    

  private string ModulePath    
  {        
     get { return ModuleDirectory; }
  }      

  private string ThirdPartyPath
  {        
    get { return Path.GetFullPath(Path.Combine(ModulePath, "../../ThirdParty/")); }
   }

   // constructor

**  public UE4Magic(ReadOnlyTargetRules Target) : base(Target)**
  {
    PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;

    PublicDependencyModuleNames.AddRange(new string] { "Core", "CoreUObject", "Engine", "InputCore", "HeadMountedDisplay" });

**LoadYJMagicLib(Target);**
  }      

  public bool LoadYJMagicLib(TargetInfo Target)
  {        
    bool isLibrarySupported = false;

     if ((Target.Platform == UnrealTargetPlatform.Win64) || (Target.Platform == UnrealTargetPlatform.Win32))
     {
       isLibrarySupported = true;

        string PlatformString = (Target.Platform == UnrealTargetPlatform.Win64) ? "x64" : "x86";
        string LibrariesPath = Path.Combine(ThirdPartyPath, "YJMagicLib", "Libraries");              

        /*             test your path with:
        using System; // Console.WriteLine("");
        Console.WriteLine("... LibrariesPath -> " + LibrariesPath);
        */

        PublicAdditionalLibraries.Add(Path.Combine(LibrariesPath, "YJMagicLib." + PlatformString + ".lib"));
      }

      if (isLibrarySupported)
        {            
           // Include path            
           PublicIncludePaths.Add(Path.Combine(ThirdPartyPath, "YJMagicLib", "Includes"));        
        }          

         PublicDefinitions.Add(string.Format("WITH_YJ_MAGIC_LIB_BINDING={0}", isLibrarySupported ? 1 : 0));
         return isLibrarySupported;    
   }
}





Change TargetInfo to ReadOnlyTargetRules.



public bool LoadYJMagicLib(TargetInfo Target)
-->
public bool LoadYJMagicLib(ReadOnlyTargetRules Target)


thanks it works !

Man!!! You are a GEM. Thank you so much. Thanks to both of you!!!