I was trying to define ll
as an alias for long long
. However, this didn't compile and threw an error.
I am using VS Code, on a Windows machine. I'm also using gcc version 8.2.0.
This is the code -
#include <bits/stdc++.h>
using namespace std;
#define ll long long int;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll t;
cin >> t;
return 0;
}
On compiling this, I got this error -
test.cpp: In function 'int main()':
test.cpp:5:22: error: declaration does not declare anything [-fpermissive]
#define ll long long int;
^~~
test.cpp:12:5: note: in expansion of macro 'll'
ll t;
^~
test.cpp:12:8: error: 't' was not declared in this scope
ll t;
^
test.cpp:12:8: note: suggested alternative: 'tm'
ll t;
The weird thing is that this exact code works on other machines. Can someone please explain this to me?