c++unreal-engine4

Error "too many arguments in function call" C++


I wrote a small debugging code that allows you to display the Processor, Video card, as well as the user's OS When writing code using a function

static FString GetOSVersion()

I get the numeric version of the OS When using another function (which is used in the code), it should show more information. The function itself

static void GetOSVersions
(
    FString & out_OSVersionLabel,
    FString & out_OSSubVersionLabel
)

I implemented it into the code, but for some reason I have an error, please help me. (I'm just learning c++, so maybe a very stupid question)

Code Screen: enter image description here

I tried to fix the code, Googled, asked the AI, but the same Chat GTP says that the code is executed correctly, they say The problem in your code is calling the static function FWindowsPlatformMisc::GetCPUBrand(), FWindowsPlatformMisc::GetCPUVendor(), FWindowsPlatformMisc::GetPrimaryGPUBrand(), FWindowsPlatformMisc::GetOSVersion() and FWindowsPlatformMisc::NumberOfCores(). Your project is probably configured to use a different operating system or platform than Windows.

To fix the "too many arguments in function call" error, you should use the appropriate functions for your target platform. For example, if you are using a different platform, then you need to use other methods to get information about the processor, graphics card, operating system version and the number of processor cores.

Let's assume that you are working with the Windows platform and have correctly connected all the necessary libraries. Then your code might look something like this:


Solution

  • well, if you are calling GetOSVersion (note the absence of the trailing s) the propotype specifies that it takes no arguments, and you are passing two, therefore the too many arguments error.