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"

Link error on regular constructor

I'm trying to add a new actor, inheriting from a class called ABaseNineSliceActor. I already have 10 or so other classes inheriting from this class just fine.

In the new class, called AFixedWindow, I'm trying to define the constructor, so I can initialize the components it needs. Basic stuff. However, for an unknown reason I'm now getting a link error stating that the constructor has already been defined. It must be in the generated code, since there are no other mentions of the class name in the solution. I get the same problem when I make a new empty class with a different name - I'm at a loss here.

I attempted just leaving the constructor for what it is and creating the component at runtime using NewObject<>, RegisterComponent() and AttachComponent(), but querying the component in a subsequent call throws an access violation (even IsValid() throws an access violation, kind of defeating its point).


 #pragma once
 #include "BaseNineSliceActor.h"
 #include "FixedWindow.generated.h"
 class PROJECT_API AFixedWindow : public ABaseNineSliceActor


 #include "Project.h"
 #include "FixedWindow.h"


So.. help?

Product Version: UE 4.18
more ▼

asked Jan 09 '18 at 09:56 AM in C++ Programming

avatar image

23 2 4

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

1 answer: sort voted first

Hi there,

The code you have here is basically an empty class template, so there must not be any issues with it. Have you tried the nuclear option? :D Very often such erratic compiler behaviors get fixed by simply regenerating and rebuilding your Visual Studio solution. Please refer to my answer here where I explain how to do this.

Hope this helps :-)

more ▼

answered Jan 09 '18 at 10:33 AM

avatar image

1.5k 10 10 17

avatar image Lhorkan Jan 09 '18 at 11:08 AM

Just added the classes again, and after another nonsensical error about the .generated file not existing, it decided to start working after all. I already tried removing and adding the classes back several times before, I changed nothing (because the code was already correct).

At least it works now, though a couple of hours have gone down the drain.

(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