Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xcode/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 当我在线提交时,他们总是说编译错误_C++_Xcode_Gcc - Fatal编程技术网

C++ 当我在线提交时,他们总是说编译错误

C++ 当我在线提交时,他们总是说编译错误,c++,xcode,gcc,C++,Xcode,Gcc,这是我的密码: 它在我的mac电脑上运行良好。 但我不确定Gcc版本的问题是否存在。 他们说sstream和string头是错误的 1779655.134485/Main.c:8:19:致命错误:sstream:没有这样的文件或目录 编译终止 这是提示 #include <iostream> #include <sstream> #include <string> using namespace std; #包括 #包括 #包括 使用名称空间std; >

这是我的密码: 它在我的mac电脑上运行良好。 但我不确定Gcc版本的问题是否存在。 他们说sstream和string头是错误的

1779655.134485/Main.c:8:19:致命错误:sstream:没有这样的文件或目录 编译终止

这是提示

#include <iostream>
#include <sstream>
#include <string>
using namespace std;
#包括
#包括
#包括
使用名称空间std;

<代码> > p>您试图在C++代码程序中包含C++头文件。 Gcc是C编译器


您需要将
Main.c
重命名为
Main.cpp
并使用g++编译器c
更改为
c++
,然后重新编译/运行@Borgeader也许你应该把它作为答案,我的文件是.cpp