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"

Weird LINK2001 and 2019 error

Whenever I compile the code, these two errors appear:

LNK2001 unresolved external symbol "public: __cdecl UKeybindingUMG::UKeybindingUMG(class FObjectInitializer const &)" (??0UKeybindingUMG@@QEAA@AEBVFObjectInitializer@@@Z)

LNK2019 unresolved external symbol "public: __cdecl UKeybindingUMG::UKeybindingUMG(class FObjectInitializer const &)" (??0UKeybindingUMG@@QEAA@AEBVFObjectInitializer@@@Z) referenced in function "public: void __cdecl UKeybindingUMG::`default constructor closure'(void)" (??_FUKeybindingUMG@@QEAAXXZ)

KeybindingUMG.cpp:

 // Fill out your copyright notice in the Description page of Project Settings.
 
 #include "KeybindingUMG.h"
 #include "Project.h"

KeybindingUMG.h:

 // Fill out your copyright notice in the Description page of Project Settings.
 
 #pragma once
 
 #include "CoreMinimal.h"
 #include "Blueprint/UserWidget.h"
 #include "KeybindingUMG.generated.h"
 
 /**
  * 
  */
 UCLASS()
 class PROJECT_API UKeybindingUMG: public UUserWidget
 {
     GENERATED_UCLASS_BODY()
 };
 

I can't find anything contextually wrong from this. It would be great if anyone can tell me what have I done wrong.

Product Version: UE 4.18
Tags:
more ▼

asked May 23 '18 at 11:38 PM in C++ Programming

avatar image

Paul_LTC
35 4 5 11

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

Using old GENERATED_UCLASS_BODY() requires you to create constructor in same formul as linking error suggesting, the constructor is called in generated code thats why you don't see it.

Use new GENERATED_BODY() instead it does not require any constructor the old macro probably will be deprecated sooner or later, just remember with this one you need ot place "public:" as by default any feather declarations in class will be private by default

more ▼

answered May 23 '18 at 11:48 PM

avatar image

Shadowriver
37.8k 937 172 1123

avatar image Paul_LTC May 24 '18 at 01:31 AM

Thanks! This saved me from several hours of debugging haha

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

As you're using GENERATED_UCLASS_BODY(), you should provide a constructor in your .cpp file.

If you don't want to write a constructor, you can use GENERATED_BODY() instead

more ▼

answered May 23 '18 at 11:48 PM

avatar image

phil_me_up
1.6k 6 6 12

avatar image Paul_LTC May 24 '18 at 01:31 AM

Thanks! This saved me from several hours of debugging haha

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
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