MrFrenik / gunslinger

C99, header-only framework for games and multimedia applications

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compile error with gcc, on macos 10.12.

zakarouf opened this issue · comments

System

OS: MacOS 10.12

Issue

There is a Compile error with miniaudio.h while compiling with gcc.

using: https://github.com/MrFrenik/gs_examples/tree/main/22_first_person_camera

>>> gcc main.c -framework CoreFoundation -framework CoreVideo -framework IOKit -framework Cocoa -framework Carbon -framework CoreAudio -lglfw3

Here is the error, since its too big to post here.

The problem stems from the miniaudio.h with the macos' audio framework.

...
In file included from /System/Library/Frameworks/CoreAudio.framework/Headers/CoreAudio.h:19,
                 from /Users/zak/.local/include/gunslinger/external/miniaudio/miniaudio.h:22393,
                 from /Users/zak/.local/include/gunslinger/impl/gs_audio_impl.h:415, 
                 from /Users/zak/.local/include/gunslinger/gs.h:5950,
                 from main.c:17:
...

GCC

>>> gcc -v                                                                                                                                                           
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/opt/local/libexec/gcc/x86_64-apple-darwin16/10.2.0/lto-wrapper
Target: x86_64-apple-darwin16
Configured with: /opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_lang_gcc10/gcc10/work/gcc-10.2.0/configure --prefix=/opt/local --build=x86_64-apple-darwin16 --enable-languages=c,c++,objc,obj-c++,lto,fortran,jit --libdir=/opt/local/lib/gcc10 --includedir=/opt/local/include/gcc10 --infodir=/opt/local/share/info --mandir=/opt/local/share/man --datarootdir=/opt/local/share/gcc-10 --with-local-prefix=/opt/local --with-system-zlib --disable-nls --program-suffix=-mp-10 --with-gxx-include-dir=/opt/local/include/gcc10/c++/ --with-gmp=/opt/local --with-mpfr=/opt/local --with-mpc=/opt/local --with-isl=/opt/local --enable-stage1-checking --disable-multilib --enable-lto --enable-libstdcxx-time --with-build-config=bootstrap-debug --with-as=/opt/local/bin/as --with-ld=/opt/local/bin/ld --with-ar=/opt/local/bin/ar --with-bugurl=https://trac.macports.org/newticket --enable-host-shared --disable-tls --with-pkgversion='MacPorts gcc10 10.2.0_5'
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 10.2.0 (MacPorts gcc10 10.2.0_5)

Using Clang

Using clang however, it works as intended

>>> clang-mp-13 -v                                                                                                                                                   
clang version 13.0.0
Target: x86_64-apple-darwin16.7.0
Thread model: posix
InstalledDir: /opt/local/libexec/llvm-13/bin
>>> clang-mp-13 main.c -framework CoreFoundation -framework CoreVideo -framework IOKit -framework Cocoa -framework Carbon -framework CoreAudio -lglfw3

I have also tried with different versions of clang, 10, 9 it works the same.

Screen Shot 2022-01-24 at 17 57 15