Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gcc compile error in macos: first parameter of 'main' (argument count) must be of type 'int' #64

Open
yinsongbj opened this issue Mar 15, 2021 · 2 comments

Comments

@yinsongbj
Copy link

I got a error when build c4 in macos 10.15

c4.c:333:5: error: first parameter of 'main' (argument count) must be of type 'int'
int main(int argc, char **argv)

My gcc version

gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 12.0.0 (clang-1200.0.32.29)
Target: x86_64-apple-darwin20.2.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Does it not support MacOS and UNIX?

@kevintsq
Copy link

It is because of #define int long long. Change int main(int argc, char **argv) to signed main(signed argc, char **argv) works.

@andrakis
Copy link

c4 does not know about the type signed, so whilst it compiles with gcc it can't interpret itself anymore.

At the top of the file is a line:

#define int long long

This causes issues on some compilers. Instead try:

#define int long

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants