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"

Compiling fails as soon as I add a second UCLASS!?

Hello I started to develop an Artnet Plugin. Sending the packages works fine now. But when I wanted to programm a udp Receiver I ran in to some strange compiling errors. I'm using Visual Studio Community 2015.

I created the plugin in the unreal engine via going to plugins-> new plugin -> Blueprint library

my ArtNet.build.cs looks like this:

 using UnrealBuildTool;
 
 public class ArtNet : ModuleRules
 {
     public ArtNet(TargetInfo Target)
     {
         
         PublicIncludePaths.AddRange(
             new string[] {
                 "ArtNet/Public"
                 
                 // ... add public include paths required here ...
             }
             );
                 
         
         PrivateIncludePaths.AddRange(
             new string[] {
                 "ArtNet/Private",
                 
                 // ... add other private include paths required here ...
             }
             );
             
         
         PublicDependencyModuleNames.AddRange(
             new string[]
             {
                 "Core",
                 "Sockets",
                 "Networking"
                 
                 // ... add other public dependencies that you statically link with here ...
             }
             );
             
         
         PrivateDependencyModuleNames.AddRange(
             new string[]
             {
                 "CoreUObject",
                 "Engine",
                 "Slate",
                 "SlateCore",
 
                 // ... add private dependencies that you statically link with here ...    
             }
             );
         
         
         DynamicallyLoadedModuleNames.AddRange(
             new string[]
             {
                 // ... add any modules that your module loads dynamically here ...
             }
             );
     }
 }



So in the "public" folder ther is my "ArtNetBPLibrary.h". It looks like this:

 // Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
 
 #pragma once
 
 #include "Engine.h"
 #include "ArtNetBPLibrary.generated.h"
 
  
 UCLASS()
 class UArtNetBPLibrary : public UBlueprintFunctionLibrary
 {
     GENERATED_UCLASS_BODY()
 
     UFUNCTION(BlueprintCallable, meta = (DisplayName = "Setup ArtNet-UDP-Networking", Keywords = "ArtNet initialize dmx"), Category = "ArtNet")
     static void SetupArtNetUDPNetworking(const FString& DestinationIP = "192.168.0.1", const int32 DestinationPort = 6454, const int32 SourcePort = 6454);
     
     UFUNCTION(BlueprintCallable, meta = (DisplayName = "Set ArtNet-DMX-Package-Routing", Keywords = "ArtNet header set dmx"), Category = "ArtNet")
     static void SetArtNetRouting(int net = 0, int subnet = 0, int universe = 0);
     
     UFUNCTION(BlueprintCallable, meta = (DisplayName = "Set DMX Channel", Keywords = "ArtNet DMX channel set"), Category = "ArtNet")
     static void SetDmxChannel(int channel = 1, int value = 0, bool valueInPercent = true);
     
     UFUNCTION(BlueprintCallable, meta = (DisplayName = "Set all DMX Channels", Keywords = "ArtNet DMX channels set all"), Category = "ArtNet")
     static void SetAllDmxChannels(int value = 0, bool valueInPercent = true);
     
     UFUNCTION(BlueprintCallable, meta = (DisplayName = "Send ArtNet-DMX-Package", Keywords = "ArtNet DMX send"), Category = "ArtNet")
     static void SendArtNetDMXPackage(bool useSequencing = true);
     
 };

Everything works fine until here. It compiles and my blueprints work inside of Unreal. But when I add another declaration to the file it doesn't compile anymore. For example when I add this right below the code:

 UCLASS()
 class ArtNetUDPReceiver : public UBlueprintFunctionLibrary
 {
     GENERATED_UCLASS_BODY()
 };

or the exact same error, when I add a Ustruct instead:

 USTRUCT(BlueprintType)
 struct ArtNetDMXData
 {
     GENERATED_USTRUCT_BODY()
 
     UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "ArtNetProp")
     int Squence = 0;
 
     UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "ArtNetProp")
     int Net = 0;
 
     UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "ArtNetProp")
     int Subnet = 0;
 
     UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "ArtNetProp")
     int Universe = 0;
 
     ArtNetDMXData()
     {}
 };


Unfortunately the error message is in german and I can't get my visual studio to report the errors in english! It says: "Diese Deklaration hat keine Speicherklasse oder keinen Typspezifizierer"

Any ideas on what I'm doing wrong? I also tried to make a new file for the "ArtNetUDPReceiver", but in this .h file it was exactly the same...

Any help is highly appreciated! Thanks in Advance, Johannes

Product Version: UE 4.12
Tags:
more ▼

asked Jul 29 '16 at 08:29 PM in C++ Programming

avatar image

Appsite GmbH
92 4 5 21

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

1 answer: sort voted first

First thing i can see wrong here is fact that you not follow naming convention and it could mess up code generated by UHT. UObjects should start with letter "U", AActors with "A", Structs with "F"

2nd is that you use default int, reflection system does not support them due fact that each compiler for specific platform can have different default int size set (or else something changed that i don't know). Reflection system supports only int32 (Integer type in blueprints) and uint8 (Byte type in blueprints). If you use type unsupported by reflection system it can compile, but you will have useless invalid type pin in node or gray out text box in properties.

Also something tells me that UArtNetUDPReceiver is not just for static nodes, if this suppose to be a object that somebody can create it should derived from UObject not UBlueprintFunctionLibrary. UBlueprintFunctionLibrary is for node libraries with static functions that you can't assign to particular class. Also note that static classes work the same anywhere, it makes no difference for BP.

more ▼

answered Jul 29 '16 at 10:54 PM

avatar image

Shadowriver
35.2k 921 166 1098

avatar image Appsite GmbH Jul 30 '16 at 01:24 PM

Thanks for the tipps! I changed all "int" to "uint8" and "int32" and put an F in front of the struct name. The Ustruct works fine, now! Thanks. And yes you are right, it doesn't make any sense to derive from UBluepritnFunctionLibrary with my new class. I just ended up trying this, because a few lines above the exact same code works... so i thought, maybe it works if I make it the exact same. Ok, I now derived it from AActor and put an "A" before the name. But I still can't get the class to compile.

 UCLASS()
 class AArtNetUDPReceiver : public AActor
 {
     GENERATED_UCLASS_BODY()
 };

Still the same error. I also tried to derive from UObject and put an"U" before the name:

 UCLASS()
 class UArtNetUDPReceiver : public UObject
 {
     GENERATED_UCLASS_BODY()
 };

The same. Any Idea?

avatar image Shadowriver Jul 30 '16 at 03:05 PM

change GENERATED_UCLASS_BODY to GENERATED_BODY, also try rebuilding

avatar image Appsite GmbH Jul 31 '16 at 11:18 AM

Thanks! Using "GENERATED_BODY" worked. I don't understand why there is a problem with GENERATED_UCLASS_BODY though.

But now, as soon as I move this class (the exact same code) in it's own .h file with including the exact same headers it stopps building, again with the same error... (the new file is also in the same directory)

avatar image Appsite GmbH Aug 02 '16 at 06:08 PM

Ok, I got it working!

This article about the Unreal Reflection System helped me alot: https://www.unrealengine.com/blog/unreal-property-system-reflection

So the key was to include the xxx.generated.h file and afterwards hit "generate visual studio files":

include "FileName.generated.h"

(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