2 years ago

#41302

test-img

Ichchha Gupta

identifier "__int128_t" is undefined

I am trying to use a 128 data type "__int128_t" in my VSCode while writing a C++ program, but I am getting an error saying identifier "__int128_t" is undefined. However, it works perfectly on my friend's PC. I thought since he installed the MinGW GCC compiler recently so there must be an issue with my version as it is comparatively old as compared to his, so I updated my g++ to version 11.2.0. Still, even after this, "__int128_t" is not working in my C++ program which I am writing in VS Code. This is my code.

#include <bits/stdc++.h>
using namespace std;
void fastIO()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}
int main()
{
    fastIO();
    long long input[100000], n;
    cin >> n;
    __int128_t sum1 = (n * (n + 1)) / 2;
    __int128_t sum2 = 0;
    for (int i = 0; i < n - 1; i++)
    {
        cin >> input[i];
        sum2 += input[i];
    }
    cout << sum1 - sum2;
    return 0;
}

c++

g++

mingw

visual-studio-code

identifier

0 Answers

Your Answer

Accepted video resources