I am working on learning c++ and tried to build a simple hello world program in Xcode (MacOS Catalina). It is a Command line program. I followed the prompt on Xcode and accepted all the default parameters then created a cppfile with the following code
#include <stdio.h>
#include <iostream>
int main(){
std::cout<< "hello";
return 0;
}
This doesn't compile and gives me a Lexical or Prepreocessor error:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/errno.h:31:15: 'errno.h' file not found
As well as two semantic errors: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cstring:71:9: No member named 'strcpy' in the global namespace
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cstring:73:9: No member named 'strcat' in the global namespace
From what I can tell these issues are linked to including IOStream. I don't understand why they are happening though I have written c++ using visual studio on a windows machine before and never had this issue. Ive never had so much difficulty with a hello world program before.
EDIT
I created a new project in Xcode and it worked in the new one. I am not sure what mistake I made the first time.
My project was a framework instead of an Xcode project. I discovered this by looking under the products folder and seeing it was .framework instead of .app.