Cannot find stdio.h on M1 Mac Apple Silicon

  apple-silicon, c++, g++

I’m attempting to compile a hello world program on the new Apple Silicon.

I’m in Visual Studio Code running under emulation with Rosetta 2.

This is my code:

#include <iostream>

int main() {
    std::cout << "Hello World!";
    return 0;
}

I get the error:

[Running] cd "/Users/jacob/Documents/VS Code/" && g++ helloWorld.cpp -o helloWorld && "/Users/jacob/Documents/VS Code/"helloWorld
helloWorld.cpp:1:17: warning: extra tokens at end of #include directive [-Wextra-tokens] #include ;
^
//
helloWorld.cpp:1:10: fatal error: ‘stdio’ file not found
#include ;
^~~~~~~
1 warning and 1 error generated.

[Done] exited with code=1 in 0.072 seconds

I think the key here is that g++ is the underlying compiler and that stdio cannot be found. Maybe the answer here is to determine if g++ is functional, or how to make g++ functional, but any help is much appreciated!

Source: Windows Questions C++

LEAVE A COMMENT