Compilation Issues with Xcode 14 for <vector> <map> <iostream> etc.

I'm trying to compile with a brand new install of Xcode 14. A very simple .cpp and .h for testing.

The .h has:

#include "mcut.h"
#include &lt;stdio.h>
#include &lt;stdlib.h>

The .cpp has:

#include "MCut_Wrapper.hpp"
#include &lt;iostream>

I know this doesn't do anything.... but with the #include <iostream>

When I compile I suddenly get:

  • No member named 'memcpy' in namespace 'std::__1'; did you mean simply 'memcpy'?
  • No member named 'memmove' in namespace 'std::1'; did you mean simply 'memmove'?_

etc.

without the #include <iostream> everything compiles without any errors.

The same errors show up for any #includes such as <vector> <map> etc.

I've also tried adding using namespace std;

But that doesn't work.

I've tried a simple hello world program like this:

#include "MCut_Wrapper.hpp"
#include &lt;iostream>
#include &lt;vector>
#include &lt;string>

using namespace std;

int main()
{
    vector&lt;string> msg{"Hello", "C++", "World", "from", "VS Code", "and the C++ extension!"};

    for (const string&amp; word : msg)
    {
        cout &lt;&lt; word &lt;&lt; " ";
    }
    cout &lt;&lt; endl;
}

But it also throws out the same error.

Any and all assistance to get this working would be appreciated. I'm attempting to make a bundle with Xcode 14 on a machine with an M2 Max Chip (if that makes any difference).

Cheers

This is working for me. Specifically:

  1. Using Xcode 14.2, I created a new project from the macOS > Command Line Tool template, selecting C++ as the language.

  2. I replaced the contents of main.cpp with the code you posted.

  3. I chose File > New > File, selected the Header File template, and named that MCut_Wrapper.hpp.

  4. I replaced its contents with:

    &#x2F;&#x2F; #include "mcut.h"
    #include &lt;stdio.h>
    #include &lt;stdlib.h>
    

    Note that I commented out the first line because you didn't say what was in mcut.h.

  5. I chose Build > Run. The tool built, run, and printed:

    Hello C++ World from VS Code and the C++ extension! 
    

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Compilation Issues with Xcode 14 for &lt;vector&gt; &lt;map&gt; &lt;iostream&gt; etc.
 
 
Q