Embedding in C++ on Mac M1 Darwin - No member named array

I am looking into the example on https://docs.julialang.org/en/v1/manual/embedding/ on embedding Julia into C++ on my MAC Darwin M1.

I simplified the code further to

// Example from https://docs.julialang.org/en/v1/manual/embedding/
#include <julia.h>
JULIA_DEFINE_FAST_TLS // only define this once, in an executable (not in a shared library) if you want fast code.

int main(int argc, char *argv[])
{
  return 0; 
}

On purpose I exclude linking at this stage, and compile using

echo $mylib  
/Users/djplahaye/.julia/juliaup/julia-1to .10.5+0.aarch64.apple.darwin14/lib

g++ -c -fPIC main1.C -I$myinclude

to obtain the error message

In file included from main1.C:2:
In file included from /Users/djplahaye/.julia/juliaup/julia-1.10.5+0.aarch64.apple.darwin14/include/julia/julia.h:80:
In file included from /Users/djplahaye/.julia/juliaup/julia-1.10.5+0.aarch64.apple.darwin14/include/julia/julia_threads.h:7:
/Users/djplahaye/.julia/juliaup/julia-1.10.5+0.aarch64.apple.darwin14/include/julia/work-stealing-queue.h:41:13: error: expected parameter declarator
    alignas(JL_CACHE_BYTE_ALIGNMENT) _Atomic(int64_t) top;
<cut>

Thx for advice.

It suffices to add

-std=c++17

as compile option to fix the issue (with gratitude to perplexity.ai).

It’s not mentioned there in Julia’s docs, that it’s needed. In fact it’s about embedding into C, and thus I would have thought any old (C and) C++ ok too.

FYI: Jluna project since you’re using C++, as better than just using Julia docs. Please make a PR about requiring C++17 if that for sure needed, and mention maybe only needed for macOS.

What did the AI tell you, or why do you think this was needed (and only on macOS?)?

Short answer: I am not sure about any of thus. My first aim was to get things to work.
I am following the tutorial at 10 examples of embedding Julia in C/C++ | by Abel Soares Siqueira | Netherlands eScience Center Likely Abel knows more.

Longer answer: I asked perplexity.ai if the advice applied to Intel Windows and Linux systems, or does it apply to only Mac or ARM CPU’s. Perplexity.ai returned:

The advice to use C++17 or later for better compatibility with C11 atomics is generally applicable across different platforms and CPU architectures, including Intel-based Windows and Linux computers, as well as macOS and ARM CPUs.

The advice to use C++17 for better C11 atomic compatibility is based on the C++17 standard’s improvements in this area, which are implemented by compiler vendors across different platforms and architectures