Home > Mobile >  Predefined C Types (compiler internal) Not Found error
Predefined C Types (compiler internal) Not Found error

Time:10-22

I'm attempting to write a game of tic tac toe just for fun and am running into this error when I try to debug the application. The error occurs on line 23, the multidimensional std::array declaration. I can't find any material on the subject or come up with my own solution. The error shows up in a "Source not found" tab in VS 2019, doesn't look like a normal error, and this is the text: "predefined C types (compiler internal) not found You need to find predefined C types (compiler internal) to view the source for the current call stack frame."

#include <io.h>
#include <fcntl.h>
#include <iostream>
#include <algorithm>
#include <array>
#include <string>

class tic_tac_toe
{
private:
    enum class values
    {
        X,
        O,

        max_values
    };
    struct square_data
    {
        std::string code{};
        values value{};
    };
    std::array<std::array <square_data, 3>, 3> board{};
public:
    tic_tac_toe()
    {
        for (int a{ 0 }; a < 3;   a)
        {
            for (int b{ 0 }; b < 3;   b) { 
                switch (a)
                {
                case 0:
                    board.at(a).at(b).code = "A";
                    board.at(a).at(b).value = values::max_values;
                    break;
                case 1:
                    board.at(a).at(b).code = "B";
                    board.at(a).at(b).value = values::max_values;
                    break;
                case 2:
                    board.at(a).at(b).code = "C";
                    board.at(a).at(b).value = values::max_values;
                    break;
                default:
                    std::cout << "initializer failed\n"; //shouldn't happen
                }
                board.at(a).at(b).code.append(std::to_string((b   1)));
            }
        }
        print_grid();
    }

    void print_code(square_data square)
    {
        switch (square.value)
        {
        case values::X:
            std::wcout << L"X";
            break;
        case values::O:
            std::wcout << L"O";
            break;
        default:
            std::wcout << L" ";
        }
    }

    void print_grid()
    {
        fflush(stdout);
        int previous{ _setmode(_fileno(stdout), _O_U16TEXT) }; //print unicode
        for (int a{ 0 }; a < 3;   a)
        {
            switch (a)
            {
            case 0:
                std::wcout << L"\n┌───┬───┬───┐\n│ ";
                break;
            case 1:
                std::wcout << L"\n├───┼───┼───┤\n│ ";
                break;
            case 2:
                std::wcout << L"\n├───┼───┼───┤\n│ ";
                break;
            default:
                std::cout << "printer failed\n";
            }
            for (int b{ 0 }; b < 3;   b) {
                print_code(board.at(a).at(b));
                std::wcout << L" │ ";
            }

        }
        std::wcout << L"\n└───┴───┴───┘\n";
        fflush(stdout);
        _setmode(_fileno(stdout), previous); //for switching back to narrow output
    }
};

int main()
{
    tic_tac_toe game{};

    return 0;
    
}

CodePudding user response:

This is an error of VS. It works when I remove /permissive-. This problem has already been reported.

  • Related