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

The project is not built using Clang (MacOS, M1). #11

Open
Vadimatorik opened this issue Mar 8, 2022 · 3 comments
Open

The project is not built using Clang (MacOS, M1). #11

Vadimatorik opened this issue Mar 8, 2022 · 3 comments

Comments

@Vadimatorik
Copy link

% make 
cc -D_POSIX_C_SOURCE=2 -std=c99 -Wall -g -o imcat imcat.c -lm
imcat.c:87:4: error: implicitly declaring library function 'snprintf' with type 'int (char *, unsigned long, const char *, ...)' [-Werror,-Wimplicit-function-declaration]
                        snprintf( tripl, sizeof(tripl), "%d;%d;%dm ", r,g,b );
                        ^
imcat.c:87:4: note: include the header <stdio.h> or explicitly provide a declaration for 'snprintf'
1 error generated.
make: *** [imcat] Error 1

My envairement:

% 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 13.0.0 (clang-1300.0.29.30)
Target: arm64-apple-darwin21.3.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
% g++ -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 13.0.0 (clang-1300.0.29.30)
Target: arm64-apple-darwin21.3.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
@epiciskandar
Copy link

epiciskandar commented May 31, 2022

Same here.
But you've already know this is something wrong with clang, there is nothing helpful with gcc version info.
My Solution:

change Makefile , let imcat build without those args: cc -g -o imcat imcat.c -lm

Not much sure what is really wrong there, this just works.

clang version: Apple clang version 13.1.6

@stolk
Copy link
Owner

stolk commented May 31, 2022

stdio.h is the first included file. I have no idea why MacOS clang can't find it. I'm kinda stomped on this.

@stolk
Copy link
Owner

stolk commented May 31, 2022

Can you try adding -D_DARWIN_C_SOURCE to the Makefile?

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