You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After fixing compile error and some warnings, I got 329: duplicate global definition when compiling and interpreting itself. Why did it happen?
The modified code is as follows:
The problem is that c4 does not know about the type signed, it only knows char, int, and void (and pointers to those.)
When I ran your code, my line numbers ended up a bit different, but the line that c4 complained about was:
signed main(signed argc, char **argv) {
If you're already making changes to the code, you may look to the root of why you tried to go for signed in the first place - it looks like you were getting compile errors regarding main. The cause of that errors is actually at the top of the file:
#define int long long
It wasn't always there, and was added to solve issues with 64bit compilation whereby a 16bit int is not big enough to hold a pointer to a memory location (which worked on 32bit.)
That definition doesn't work on all compilers unfortunately. It's needed on some, on others it causes issues. There is an alternative:
#define int long
That is what I chose on my version of c4, and seems to work for me across a wider range of platforms. It may work for you too.
You would then revert the signed back to int, and it should work.
Thanks a lot! I realized that when I inspected the type enum. But the MinGW 8.1.0 also cannot compile it if argc has the type long. Maybe I can modify the code so that it can support signed.
After fixing compile error and some warnings, I got
329: duplicate global definition
when compiling and interpreting itself. Why did it happen?The modified code is as follows:
The text was updated successfully, but these errors were encountered: