I keep getting theis error n unreal

C:\Users\andre\Desktop\BULLCOWGAME\BullCowGame-starter-kit\Source\BullCowGame\BullCowCartridge.cpp(80) : error C4002: too many arguments for function-like macro invocation ‘TEXT’

if i get this errror sometimes i jsut mush two printlines together and this error disapears,How do i stop this?

The TEXT macro has the ability to format so TEXT("%d %d",1,2) would work.
if you do TEXT("Hello", "World"), this would fail as there’s no format in the first string and so the macro does not expect a second parameter. You can’t just lump them together like that

If you want to use TEXT to combine multiple strings, you can do the following:
TEXT("%s %s %s", "Hello","String","Three")
This would generate output as Hello String Three
I hope this helps.

no, Im sorry i dont mean that, like you said, if i mave two print lines one like PrintLine(TEXT(“HELLO %s), *Bobby); and another like PrintLine(TEXT(“HELLO %s”), *Bob); i mush them together like TEXT(”%s %s %s", “Hello”,“String”,“Three”); then on unreal it will be able to compile message

My mistake. when using PrintLine, do the following
PrintLine(TEXT("%s %s %s"), *fstr1, *fstr2, *fstr3);
This should work. Note that the string for the format only should be enclosed in TEXT and not the parameters as well.

Yea, Im osrry for my terrrible code writing, but its not that im wriing the code wrong, as I believe that I would have error squiggle, but that now Im just gettting the error C:\Users\andre\Desktop\BULLCOWGAME\BullCowGame-starter-kit\Source\BullCowGame\BullCowCartridge.cpp(89) : error C4002: too many arguments for function-like macro invocation ‘TEXT’.
One way that it USED to work was
PrintLine(TEXT(“Sorry that was incorrect but u still HAVE %i lives\nThe word is %i letters long”), Lives, HiddenWord.Len());
Note the \n, if I just kept these two printlines separate I got error message but when I put them together they work. Now this stopped being the case and Idk what to do

I need to see more of the code to help. Does it build if you take the line out completely (comment out would do)?

nope nvm, I went on discord and this guy said do
UE_LOG(LogTemp, Error, TEXT(“You have %i lives left”), Lives); instead of the usual way. and the unreal engine acually compiled my code for some reason.

Privacy & Terms