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"

How can I resolve error C2664: 'ConstructorHelpers::FObjectFinder::FObjectFinder(const ConstructorHelpers::FObjectFinder &)' : cannot convert argument 1 from 'FString' to 'const TCHAR *'?

Hey Guys,

I'm trying to dynamically load a .csv file via code. However I get this error:

error C2664: 'ConstructorHelpers::FObjectFinder::FObjectFinder(const ConstructorHelpers::FObjectFinder &)' : cannot convert argument 1 from 'FString' to 'const TCHAR *'

 // Code above this is irrelevant
 
     FString testSong = TEXT("DataTable'/Game/SongData/Arroz/arroz_track_01.SongNoteData'");
     generateNotes(testSong);
 }
 
 std::vector<ANoteSphere> ASongMode::generateNotes(FString song)
 {
     UDataTable* songData;
     ConstructorHelpers::FObjectFinder<UDataTable> SongLookupData_BP(song);
     songData = SongLookupData_BP.Object;
 
     std::vector<ANoteSphere> noteSpheres;
 
     return noteSpheres;
 }
 
 



That's the code I'm using that has to do with the error. Am I missing a .h file for DataTables? Or is there something else causing this error? I am a total UE4 noob so I'm still trying to wrap my head around some concepts...

Product Version: Not Selected
Tags:
more ▼

asked Jun 11 '14 at 05:50 PM in C++ Programming

avatar image

fryedrycestyle
6 5 7 8

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

2 answers: sort voted first

The Answer

  ConstructorHelpers::FObjectFinder SongLookupData_BP(*song); //note the *

Reason

inner data of FString accessed as TCHAR is the operator

*FString = TCHAR

(*song);

Enjoy!

Rama

more ▼

answered Jun 11 '14 at 08:44 PM

avatar image

Rama
10.5k 443 341 1078

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

First as error states you need to use "const TCHAR*" instead of FString.

Also try avoid std types, try using TArray or TMap insted, doing that you sure that game will work in all platforms and compiles supported by UE4

more ▼

answered Jun 11 '14 at 06:00 PM

avatar image

Shadowriver
33.9k 916 164 1093

avatar image fryedrycestyle Jun 12 '14 at 07:04 PM

Had no idea about TArray, so I'll look into that!

(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