x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Can't build plugin in UE 4.12

Hello.

Trying to build my project in UE 4.12, but I have got error:

 Running i:/UnrealEngine/Engine/Binaries/DotNET/UnrealBuildTool.exe MyGame Development Win64 -project="i:/MyGame/MyGame.uproject" -editorrecompile -progress -noubtmakefiles -NoHotReloadFromIDE
 Messages while compiling i:\MyGame\Intermediate\Build\BuildRules\MyGameModuleRules.dll:
 i:\MyGame\Plugins\SQLite3UE4Plugin\Source\SQLite3UE4Plugin\SQLite3UE4Plugin.Build.cs(8,66) : error CS0117: "UnrealBuildTool.RulesCompiler" ?? ᮤ?ন? ??।?????? ??? "GetModuleFilename"
 ERROR: UnrealBuildTool encountered an error while compiling source files

Content of the SQLite3UE4Plugin.Build.cs file:

 using UnrealBuildTool;
 using System.IO;
 
 public class SQLite3UE4Plugin : ModuleRules
 {
     public SQLite3UE4Plugin(TargetInfo Target)
     {
         string ModulePath = Path.GetDirectoryName( RulesCompiler.GetModuleFilename( this.GetType().Name ) );
         string PlatformString = (Target.Platform == UnrealTargetPlatform.Win64) ? "x64" : "x86";
         string ThirdPartyPath = Path.GetFullPath( Path.Combine( ModulePath, "../../ThirdParty/" ) );
         string LibrariesPath = Path.Combine(ThirdPartyPath, "SQLite3", "Lib");
         string IncludesPath = Path.Combine(ThirdPartyPath, "SQLite3", "Include");
         string LibraryName = Path.Combine(LibrariesPath, "SQLite3." + PlatformString + ".lib");
 
         PrivateIncludePaths.AddRange(new string[] { "SQLite3UE4Plugin/Private" });
         PublicIncludePaths.AddRange(new string[] { "SQLite3UE4Plugin/Public" });
         PublicAdditionalLibraries.Add(LibraryName);
         PublicIncludePaths.Add(IncludesPath);
 
         PublicDependencyModuleNames.AddRange(new string[] { "Engine", "Core", "CoreUObject" });
     }
 }

Is it some changes in build system in 4.12, or this is a bug? In docs https://wiki.unrealengine.com/Linking_Static_Libraries_Using_The_Build_System RulesCompiler.GetModuleFilename still present...

Product Version: UE Github Master branch
Tags:
more ▼

asked Mar 31 '16 at 01:49 PM in C++ Programming

avatar image

Arthur Khusnutdinov
600 88 90 247

avatar image Taurian Mar 31 '16 at 01:54 PM

I have a similar problem in 4.11 Preview 8

Severity Code Description Project File Line Suppression State Warning CS0612 'UnrealBuildTool.RulesCompiler.GetModuleFilename(string)' is obsolete

(comments are locked)
10|2000 characters needed characters left

2 answers: sort voted first

Build system code reworked in multiple commits. That changes starts from commit

 Code refactoring starting from commit 
 SHA-1: fc35305c51f256e3463f7f2a1f576f4347854eb4
 
 * changes to allow two projects to have the same plugin name
 UEB-258
 #codereview ben.marsh
 
 [CL 2611443 by Peter Sauerbrei in Main branch]

Solution is instead of

 string ModulePath = Path.GetDirectoryName( RulesAssembly.GetModuleFilename( this.GetType().Name ) )

use

        RulesAssembly r;
         FileReference CheckProjectFile;
         UProjectInfo.TryGetProjectForTarget("MyGame", out CheckProjectFile);
         
         r = RulesCompiler.CreateProjectRulesAssembly(CheckProjectFile);
         FileReference f = r.GetModuleFileName( this.GetType().Name );
         //File.WriteAllText("c:/temp/qqq2.txt", f.CanonicalName );
         
         string ModulePath = Path.GetDirectoryName( f.CanonicalName );

Where MyGame - is yours project name. Not plugin name, but name of the main project, that contains your project.

Example:

 using UnrealBuildTool;
 using System.IO;
 
 public class SQLite3UE4Plugin : ModuleRules
 {
     public SQLite3UE4Plugin(TargetInfo Target)
     {
         //File.WriteAllText("c:/temp/qqq.txt", this.GetType().Name);
         //string ModulePath = Path.GetDirectoryName( RulesAssembly.GetModuleFilename( this.GetType().Name ) );
         
         RulesAssembly r;
         FileReference CheckProjectFile;
         UProjectInfo.TryGetProjectForTarget("MyGame", out CheckProjectFile);
         
         r = RulesCompiler.CreateProjectRulesAssembly(CheckProjectFile);
         FileReference f = r.GetModuleFileName( this.GetType().Name );
         //File.WriteAllText("c:/temp/qqq2.txt", f.CanonicalName );
         
         string ModulePath = Path.GetDirectoryName( f.CanonicalName );
         string PlatformString = (Target.Platform == UnrealTargetPlatform.Win64) ? "x64" : "x86";
         string ThirdPartyPath = Path.GetFullPath( Path.Combine( ModulePath, "../../ThirdParty/" ) );
         string LibrariesPath = Path.Combine(ThirdPartyPath, "SQLite3", "Lib");
         string IncludesPath = Path.Combine(ThirdPartyPath, "SQLite3", "Include");
         string LibraryName = Path.Combine(LibrariesPath, "SQLite3." + PlatformString + ".lib");
 
         PrivateIncludePaths.AddRange(new string[] { "SQLite3UE4Plugin/Private" });
         PublicIncludePaths.AddRange(new string[] { "SQLite3UE4Plugin/Public" });
         PublicAdditionalLibraries.Add(LibraryName);
         PublicIncludePaths.Add(IncludesPath);
 
         PublicDependencyModuleNames.AddRange(new string[] { "Engine", "Core", "CoreUObject" });
     }
 }



more ▼

answered Mar 31 '16 at 03:22 PM

avatar image

Arthur Khusnutdinov
600 88 90 247

avatar image RiseAgainst Apr 13 '16 at 07:58 PM

Many thanks for posting this. Clear, concise, and exactly what I needed.

avatar image dj-mindar Jun 10 '16 at 05:48 PM

You saved my life! Thanks :D

(comments are locked)
10|2000 characters needed characters left

For anyone looking at how to do this without having to specify the project name (for instance if you want this to be inside a project agnostic plugin/module), you can simply replace the string ModulePath code with the (not easily found) variable "ModuleDirectory":

     private string ModulePath
     {
         get { return Path.GetDirectoryName( RulesCompiler.GetModuleFilename( this.GetType().Name ) ); }
     }
  
     private string ThirdPartyPath
     {
         get { return Path.GetFullPath( Path.Combine( ModulePath, "../../ThirdParty/" ) ); }
     }

becomes

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

or simply

     private string ThirdPartyPath
     {
         get { return Path.Combine( ModuleDirectory, "../../ThirdParty/" ) ); }
     }
more ▼

answered Apr 24 '16 at 12:29 AM

avatar image

Cameron Abt
111 3 7 18

avatar image duke22 Jun 15 '16 at 06:34 AM

What about getting the path of another module (not the caller)?

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question