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"

error LNK2019: unresolved external symbol

After adding the FInteriorSettings as a variable to the class, I get an error when compiling.

 1>Module.Riders.cpp.obj : error LNK2019: unresolved external symbol "public: __cdecl FInteriorSettings::FInteriorSettings(void)" (??0FInteriorSettings@@QEAA@XZ) referenced in function "public: __cdecl ATestActor::ATestActor(void)" (??0ATestActor@@QEAA@XZ)
 1>Riders.generated.2.cpp.obj : error LNK2001: unresolved external symbol "public: __cdecl FInteriorSettings::FInteriorSettings(void)" (??0FInteriorSettings@@QEAA@XZ)

TestActor.h

 #pragma once
 
 #include "GameFramework/Actor.h"
 #include "Sound/AudioVolume.h"
 #include "TestActor.generated.h"
 
 UCLASS()
 class RIDERS_API ATestActor : public AActor
 {
     GENERATED_BODY()
     
 public:    
     // Sets default values for this actor's properties
     ATestActor();
 
     struct FInteriorSettings InteriorSettings;
 
     /** The MyProperty */
     UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Game")
     class UBoxComponent* Collision;
 
 
     class USceneComponent* Scene;
 
     // Called when the game starts or when spawned
     virtual void BeginPlay() override;
     
     // Called every frame
     virtual void Tick( float DeltaSeconds ) override;
 
 };

TestActor.cpp

 #include "Test/TestActor.h"
 #include "Riders.h"
 
 // Sets default values
 ATestActor::ATestActor()
 {
      // Set this actor to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
     PrimaryActorTick.bCanEverTick = true;
 
 
     Scene = CreateDefaultSubobject<USceneComponent>(TEXT("Scene"));
     Scene = RootComponent;
 
     Collision = CreateDefaultSubobject<UBoxComponent>(TEXT("Collision"));
     Collision->SetupAttachment(Scene);
 }
 
 // Called when the game starts or when spawned
 void ATestActor::BeginPlay()
 {
     Super::BeginPlay();
     
 }
 
 // Called every frame
 void ATestActor::Tick( float DeltaTime )
 {
     Super::Tick( DeltaTime );
 
 }




Product Version: UE 4.16 Preview
Tags:
more ▼

asked May 11 '17 at 08:55 PM in C++ Programming

avatar image

WssIDs
10 2 3 7

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

1 answer: sort voted first

I think you need to add Engine to your project's Build.cs PublicDependencyModuleNames if it's not there already. Also you need to #include "Runtime/Engine/Classes/Sound/AudioVolume.h" in TestActor.h.

You may additionally have problems since InteriorSettings is not a UPROPERTY, so I would recommend marking it as such.

more ▼

answered May 11 '17 at 09:06 PM

avatar image

Digi Labs Dan
571 16 12 34

avatar image WssIDs May 12 '17 at 03:27 PM

All the actions that you described did not work. I get the same error. (

avatar image Digi Labs Dan May 12 '17 at 05:34 PM

#include "Test/TestActor.h"

Is this the same as your TestActor.h file or do you have two headers with the same name?

avatar image WssIDs May 12 '17 at 06:27 PM

Yes. This is the same TestActor.h

avatar image Digi Labs Dan May 12 '17 at 10:08 PM

Your code should work properly adding include .../AudioVolume.h to the top of TestActor.h and replacing struct FInteriorSettings InteriorSettings; with FInteriorSettings InteriorSettings; or at least get different error messages. What error message do you get when you make this change?

avatar image WssIDs May 14 '17 at 01:39 PM

Now my TestActor.h looks like this: #pragma once

 #include "GameFramework/Actor.h"
 #include "Runtime/Engine/Classes/Sound/AudioVolume.h"
 #include "TestActor.generated.h"
 
 UCLASS()
 class RIDERS_API ATestActor : public AActor
 {
     GENERATED_BODY()
     
 public:    
     // Sets default values for this actor's properties
     ATestActor();
 
     UPROPERTY(EditDefaultsOnly)
     FInteriorSettings InteriorSettings;
 
     /** The MyProperty */
     UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Game")
     class UBoxComponent* Collision;
 
 
     class USceneComponent* Scene;
 
     // Called when the game starts or when spawned
     virtual void BeginPlay() override;
     
     // Called every frame
     virtual void Tick( float DeltaSeconds ) override;
 
 };

But I get the same error.

 1>Module.Riders.cpp.obj : error LNK2019: unresolved external symbol "public: __cdecl FInteriorSettings::FInteriorSettings(void)" (??0FInteriorSettings@@QEAA@XZ) referenced in function "public: __cdecl ATestActor::ATestActor(void)" (??0ATestActor@@QEAA@XZ)
 1>Riders.generated.2.cpp.obj : error LNK2001: unresolved external symbol "public: __cdecl FInteriorSettings::FInteriorSettings(void)" (??0FInteriorSettings@@QEAA@XZ)
avatar image Digi Labs Dan May 15 '17 at 02:46 AM

Hmm... I'm very confused why you might still be getting linker errors here. The next things I would try:

1) Double check, by searching through your module's code, that you have not declared ATestActor in any other files.

2) Get rid of the declaration of the constructor in TestActor.h. I believe this constructor is automatically declared in by the GENERATED_BODY macro.

3) Sometimes things get weird with the Intermediate folder, especially with IDE integration. Remove that whole folder manually and then recreate it by right clicking your uproject and choosing "Generate Project Files".

avatar image WssIDs May 16 '17 at 11:13 AM

I changed the code like this TestActor.h // Fill out your copyright notice in the Description page of Project Settings. #pragma once #include "GameFramework/Actor.h" #include "TestActor.generated.h"

 struct FInteriorSettings;
 
 UCLASS()
 class RIDERS_API ATestActor : public AActor
 {
     GENERATED_BODY()
     
 public:    
     // Sets default values for this actor's properties
     ATestActor();
 
     struct FInteriorSettings InteriorSettings;
 
     /** The MyProperty */
     UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Game")
     class UBoxComponent* Collision;
 
 
     class USceneComponent* Scene;
 
     // Called when the game starts or when spawned
     virtual void BeginPlay() override;
     
     // Called every frame
     virtual void Tick( float DeltaSeconds ) override;
 
 };

I added to the TestActor.h struct FInteriorSettings;

and in the Test.cpp

 FInteriorSettings::FInteriorSettings()
     : bIsWorldSettings(false)
     , ExteriorVolume(1.0f)
     , ExteriorTime(0.5f)
     , ExteriorLPF(MAX_FILTER_FREQUENCY)
     , ExteriorLPFTime(0.5f)
     , InteriorVolume(1.0f)
     , InteriorTime(0.5f)
     , InteriorLPF(MAX_FILTER_FREQUENCY)
     , InteriorLPFTime(0.5f)
 {
 }

The compilation passed without errors.

avatar image alexfs Jun 01 '17 at 10:52 AM

Hey, this issue has been caused by someone moving the FInteriorSettings constructor from AudioVolume.h into AudioVolume.cpp. Could this be moved back please? It was done in this commit.

avatar image WssIDs May 12 '17 at 03:30 PM

This is strange, because in the file AudioDevice.h The FListener structure is used, in which this struct FInteriorSettings is described as well as I described it. But I have this error.

(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