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"

LNK2001 Changing Function Parameters

I tried to change the parameters of a function and I cannot compile for the life of me. I tried changing it from no arguments to 3 strings. It compiles nicely when I change the parameters back to void. I made sure to remove all blueprint and C++ references to the function but I can't get rid of this linker error.

I have tried:

  • Changing solution configuration

  • Refreshing visual studio project

  • "Generate visual studio project" by right clicking on the project file.

  • Deleting the binaries (won't let me launch the project)

The output:

 CompilerResultsLog: Error: HowDareFunctionLibrary.gen.cpp.obj : error LNK2001: unresolved external symbol "public: void __cdecl UGameAccountObject::AccountLogin(void)" (?AccountLogin@UGameAccountObject@@QEAAXXZ)
 CompilerResultsLog: Error: HowDareGameInstance.gen.cpp.obj : error LNK2001: unresolved external symbol "public: void __cdecl UGameAccountObject::AccountLogin(void)" (?AccountLogin@UGameAccountObject@@QEAAXXZ)
 CompilerResultsLog: Error: HowDareFunctionLibrary.cpp.obj : error LNK2001: unresolved external symbol "public: void __cdecl UGameAccountObject::AccountLogin(void)" (?AccountLogin@UGameAccountObject@@QEAAXXZ)
 CompilerResultsLog: Error: HowDareGameInstance.cpp.obj : error LNK2001: unresolved external symbol "public: void __cdecl UGameAccountObject::AccountLogin(void)" (?AccountLogin@UGameAccountObject@@QEAAXXZ)
 CompilerResultsLog: Error: HowDarePlayerCharacter.cpp.obj : error LNK2001: unresolved external symbol "public: void __cdecl UGameAccountObject::AccountLogin(void)" (?AccountLogin@UGameAccountObject@@QEAAXXZ)
 CompilerResultsLog: Error: HowDareSaveGame.cpp.obj : error LNK2001: unresolved external symbol "public: void __cdecl UGameAccountObject::AccountLogin(void)" (?AccountLogin@UGameAccountObject@@QEAAXXZ)
 CompilerResultsLog: Error: E:\Documents\Unreal Projects\HowDare\Binaries\Win64\UE4Editor-HowDare-3947.dll : fatal error LNK1120: 1 unresolved externals
 CompilerResultsLog: ERROR: UBT ERROR: Failed to produce item: E:\Documents\Unreal Projects\HowDare\Binaries\Win64\UE4Editor-HowDare-3947.dll

Unfortunately I don't really know what to do with the output. Please help!

Edit: to clarify: the function causing issues is:

 UGameAccountObject::AccountLogin(void)

Product Version: UE 4.17
Tags:
more ▼

asked Oct 06 '17 at 09:49 AM in C++ Programming

avatar image

tehhax
194 31 29 51

avatar image Dune Oct 06 '17 at 12:32 PM

I have noticed a couple of times with 4.17, I will have to delete my intermediate folder for my project as some of the .gen.cpp files get mashed up and don't work.

Sometimes, delete intermediate, regenerate project, build works. Saves having to do a full rebuild.

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

2 answers: sort voted first

Sigh... I fixed the problem by going to Build->Rebuild Solution. Clearly something was cached somewhere that wouldn't get refreshed. I tried to rebuild the project in every other way for hours but that did the trick!

more ▼

answered Oct 06 '17 at 11:11 AM

avatar image

tehhax
194 31 29 51

avatar image epernod Oct 06 '17 at 11:26 AM

ok, I was going to ask you that as link problem was refering AccountLogin(void) and not AccountLogin(const FString&,...) A good rebuild in VS is always useful when nothing works ;)

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

Hi, could you post the part of the code in HowDareGameInstance.cpp where you use the UGameAccountObject And the .h of UGameAccountObject, there might be a DLL external symbol link missing.

more ▼

answered Oct 06 '17 at 09:54 AM

avatar image

epernod
11 1 2

avatar image tehhax Oct 06 '17 at 10:01 AM

For sure! Let me know if there is anything else you'd like to look at.

HowDareGameInstance.cpp:

 #include "HowDareGameInstance.h"
 
 
 
 UHowDareGameInstance::UHowDareGameInstance() {
     this->PlayerGameAccount = NewObject<UGameAccountObject>();
     this->PlayerObject = NewObject<UHowDarePlayerObject>();
 }

UGameAccountObject.h:

 #pragma once
 
 #include "Json.h"
 #include "NetworkObject.h"
 #include "HashFunctionLibrary.h"
 #include "NetworkFunctionLibrary.h"
 
 #include "CoreMinimal.h"
 #include "UObject/NoExportTypes.h"
 #include "GameAccountObject.generated.h"
 
 DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FLoginDataReceivedSignature, const FString&, ErrorString, int32, ErrorCode);
 
 
 /**
  * 
  */
 UCLASS(Blueprintable)
 class HOWDARE_API UGameAccountObject : public UObject
 {
     GENERATED_BODY()
 
     public:
         //Constructor
         UGameAccountObject();
 
         //Login functions
         UFUNCTION(BlueprintCallable, Category = "Account Functions")
             void AccountLogin(const FString& uEmail, const FString& uUsername, const FString& uPassword);
         UFUNCTION()
             void AccountLoginComplete(const FString& HttpData);
         UPROPERTY(BlueprintAssignable, Category = "Account Functions")
             FLoginDataReceivedSignature AccountLogin_OnReceived;    
 };




Edit: note AccountLogin() used to take no parameters. I added 3 strings and can no longer compile

avatar image epernod Oct 06 '17 at 10:20 AM

and you changed also the declaration in UGameAccountObject.cpp ?

And just to understand, both classes are in the same VS project?

avatar image tehhax Oct 06 '17 at 10:24 AM

Yeah I sure did. I tried changing it to an empty function but here is the function in UGameAccountObject.cpp:

 void UGameAccountObject::AccountLogin(const FString& uEmail, const FString& uUsername, const FString& uPassword) {
 
 }
(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