Type arguments are incompatible with type parameters

Asked 1 years ago, Updated 1 years ago, 45 views

I'm trying to display the characters in the window using the code below. If the arguments are not compatible, an error message will appear and it will not work.
I'm a beginner at both languages and DX libraries, so please let me know

#include "DxLib.h"


int WINAPI WinMain (HINSTANCE, HINSTANCE, LPSTR, int) {
    ChangeWindowMode(true); // Windowing
    DxLib_Init(); // DX library initialization process
    SetDrawScreen(DX_SCREEN_BACK); // Back Screen Drawing Settings


    //
    while(ScreenFlip() == 0&ProcessMessage() == 0&ClearDrawScreen() == 0){

               // This is where the error occurs
        DrawFormatString(0,0,GetColor(255,255,255), "Hello"); // Draw characters

    }


    DxLib_End(); // DX Library Exit Processing
    return 0;
}

c

2022-09-30 21:48

2 Answers

Sorry, the character set for the property is
After changing to a multi-byte character set,
I was able to operate it without any errors


2022-09-30 21:48

This depends on the character set specification, as you have done.

For more versatility, enclose the string constant "Hello" with _T() or _TEXT().

DrawFormatString(0,0,GetColor(255,255,255),_T("Hello"));// Draw characters

This allows you to compile the character set specification without any problems, whether using the default Unicode character set or using the modified multibyte character set.

On the other hand, if you only use Unicode without changing the character set, you can add L before the first " to make it L "Hello".

Please refer to:
Unicode Programming Summary
Generic text mapping in tchar.h

The first page of a series of descriptions, including the above. Visual C++ text and string


2022-09-30 21:48

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.