No suitable user-defined conversion from "FVector2D" to "FVector" exists

no suitable user-defined conversion from “FVector2D” to “FVector” exists!

I can’t get this code to compile. I get no error messages from Unreal, but Visual Studio gives some information. Anyone know? Or have a clue?

GetLookDirection needs an FVector, but you are using ScreenLocation, which is an FVector2D.

yeah, well it all looks fine to me. what would fix it?

Change ScreenLocation to FVector instead of FVector2D in line 44.

auto ScreenLocation = FVector(ViewportSizeX * CrosshairXLocation, ViewportSize.Y * CrosshairYLocation, 0.0f);

Thanks for the feedback.

I already tried that, that is why I am here. It did not work, same message, 'no suitable user-defined conversion from “FVector2D” to “FVector” exists,.

Thought you might give me a clue.

Unreal Engine fails to compile but reports zero error messages. That is the hard truth.

Should I post my code to pastebin?

I am following this guys code, Tristem, on Udemy(His is the black screen, mine is the dark gray screen). He should know what he is doing. Somehow his code is compiling, but mine is not. I have tried imitating him literally, you can see my code is a little bit different, but either way it does not compile. You can see the FVector2D thing is not a problem for him.

I cannot create a new class in this project until I can successfully compile my code.

I passed it over before, but the Unreal Message Log say something or other is out of date, and gives a UBT ERROR. I had thought FVector was the problem, but now I think it is actually this out of date something or other. Anyone have a clue how to fix this? Also why is Text Wrap not supported in the message logger?

Thanks for the code, now everything makes much more sense. What happened actually when you tried to replace the auto for FVector2D though, like that:

FVector2D ScreenLocation = FVector2D(ViewportSizeX * CrosshairXLocation, ViewportSize.Y * CrosshairYLocation);

What message did VS give you with that one?

This is the error message I get when I edit the line thusly:
FVector2D ScreenLocation = FVector2D(ViewportSizeX * CrosshairXLocation, ViewportSizeY * CrosshairYLocation);

Your code moved some lines and it also displays another error now (too few arguments), so it’s difficult to follow.

thanks for quick reply. I went ahead and pasted my code to the pastebin.com link below. It is a small project so should be easy to read. It is so small I put all three classes in one past dividing them with forward stroke marks(/////…) and labeling them ‘// THE TankAIController.cpp’, ‘//THE TankAIController.h’, etc…

Currently I am just reading the error list hyperlinks…

https://pastebin.com/THxkPDum

having read the error list hyperlinks, the only thing my limited skill can think of is that I updated Visual Studio software to version 15.3.2 while working in this project, and so think that maybe that is why it is complaining about a ‘previous version’ of the compiler

Could try to delete the Intermediate folder and Generate Visual Studio files again (right-click on your .uproject file to do so). Keep in mind that deletes some project specific .ini’s like Color Palettes, but nothing serious that would harm your project.

I notice a new version of Visual Studio 2017 is available today (15.3.3).

I deleted the Intermediate folder like you said and did get new compiler errors. Giving us a clue.

The compiler log message above is from a compile attempt without using the Regenerate Visual Studio Project Files right-click-option in Unreal Engine Project File in the Game Assets Folder done after deleting Intermediate.

The below log is a message taken after reloading project files using the aforesaid command.

BUMP BUMP BUMP

Possibly this one should go to the bug pile for Epic?

Is the Engine version you’re using the same as the one being used in the tutorial?

No, in the tutorial he is using 4.11 (then upgrades to 4.12 and so on), I am using 4.17. obviously I would rather get it to work in 4.17 than 4.12

Fresh paste of the code on pastebin.com, the previous paste is expiring tomorrow.

https://pastebin.com/Ky1tR8ip