Получение большого количества SDL «предполагаемый тип - x, но ожидается Ux» при создании примера приложения kotlin-native - PullRequest
0 голосов
/ 29 августа 2018
L:\develop\kotlin-native\samples\tetris>call cinterop -def 
".\src\main\c_interop\sdl.def" -compilerOpts "-I\MSYS2\mingw64\include\SDL2" -target "mingw" -o sdl
 || exit /b
src\main\kotlin\SDL_Visualizer.kt:26:15: error: type mismatch: inferred type is Int but Uint32 /* = UInt */ was expected
    SDL_Delay(millis)
              ^
src\main\kotlin\SDL_Visualizer.kt:399:57: error: type mismatch: inferred type is Byte but Uint8 /* = UByte */ was expected
        SDL_SetRenderDrawColor(renderer, 127, 127, 127, SDL_ALPHA_OPAQUE.toByte())
                                                        ^
src\main\kotlin\SDL_Visualizer.kt:405:51: error: type mismatch: inferred type is Byte but Uint8 /* = UByte */ was expected
        SDL_SetRenderDrawColor(renderer, 0, 0, 0, SDL_ALPHA_OPAQUE.toByte())
                                                  ^
src\main\kotlin\Tetris.kt:275:15: error: type mismatch: inferred type is Int but UInt was expected
        srand(time(null).toInt())

переключение преобразования с .toInt() на .toUInt() исправляет это конкретное, но затем я сталкиваюсь с большим:

L:\develop\kotlin-native\samples\tetris>call cinterop -def 
".\src\main\c_interop\sdl.def" -compilerOpts "-I\MSYS2\mingw64\include\SDL2" -target "mingw" -o sdl
 || exit /b
src\main\kotlin\SDL_Visualizer.kt:26:15: error: type mismatch: inferred type is Int but Uint32 /* = UInt */ was expected
    SDL_Delay(millis)
              ^
src\main\kotlin\SDL_Visualizer.kt:399:57: error: type mismatch: inferred type is Byte but Uint8 /* = UByte */ was expected
        SDL_SetRenderDrawColor(renderer, 127, 127, 127, SDL_ALPHA_OPAQUE.toByte())
                                                        ^
src\main\kotlin\SDL_Visualizer.kt:405:51: error: type mismatch: inferred type is Byte but Uint8 /* = UByte */ was expected
        SDL_SetRenderDrawColor(renderer, 0, 0, 0, SDL_ALPHA_OPAQUE.toByte())

Почему это происходит? Это как-то связано с тем, что я создал kotlin-native для целевой платформы, которая является 64-битной Windows 7 (с ./gradlew dist distPlatformLibs)

...