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

**URL:** https://discourse.julialang.org/t/embedding-in-c-on-mac-m1-darwin-no-member-named-array/122501
**Category:** Tooling
**Tags:** question
**Created:** [November 11, 2024, 3:19pm UTC](https://discourse.julialang.org/t/embedding-in-c-on-mac-m1-darwin-no-member-named-array/122501 "2024-11-11T15:19:42Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Domenico\_Lahaye](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/domenico_lahaye/32/203728_2.png) [@Domenico\_Lahaye](https://discourse.julialang.org/u/Domenico_Lahaye)
#### Post date: [November 11, 2024, 3:19pm UTC](https://discourse.julialang.org/t/embedding-in-c-on-mac-m1-darwin-no-member-named-array/122501/1 "2024-11-11T15:19:42Z")

</div>

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

I simplified the code further to

```julia
// 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

```julia
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

```julia
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.

---

<div class="post-metadata">

### Author: ![Domenico\_Lahaye](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/domenico_lahaye/32/203728_2.png) [@Domenico\_Lahaye](https://discourse.julialang.org/u/Domenico_Lahaye)
#### Post date: [November 12, 2024, 9:51pm UTC](https://discourse.julialang.org/t/embedding-in-c-on-mac-m1-darwin-no-member-named-array/122501/2 "2024-11-12T21:51:59Z")

</div>

It suffices to add

-std=c++17

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

---

<div class="post-metadata">

### Author: ![Palli](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/palli/32/3380_2.png) [@Palli](https://discourse.julialang.org/u/Palli)
#### Post date: [November 13, 2024, 12:06am UTC](https://discourse.julialang.org/t/embedding-in-c-on-mac-m1-darwin-no-member-named-array/122501/3 "2024-11-13T00:06:55Z")

</div>

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?)?

---

<div class="post-metadata">

### Author: ![Domenico\_Lahaye](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/domenico_lahaye/32/203728_2.png) [@Domenico\_Lahaye](https://discourse.julialang.org/u/Domenico_Lahaye)
#### Post date: [November 13, 2024, 8:19am UTC](https://discourse.julialang.org/t/embedding-in-c-on-mac-m1-darwin-no-member-named-array/122501/4 "2024-11-13T08:19:10Z")

</div>

**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](https://blog.esciencecenter.nl/10-examples-of-embedding-julia-in-c-c-66282477e62c) 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
