Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/124.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/9.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+的编译错误+;(马科斯) 当我试图在MAC中编译这个非常简单的C++程序时,我得到了一个错误(HysieRa:Voice 10:133)。此Mac中使用的gcc版本为5.3.0 这是C++程序: #include<iostream> #include<cmath> #include<fstream> using namespace std; int main() { cout<<sin(1); }_C++_Macos_Gcc_Compilation_G++ - Fatal编程技术网

C+的编译错误+;(马科斯) 当我试图在MAC中编译这个非常简单的C++程序时,我得到了一个错误(HysieRa:Voice 10:133)。此Mac中使用的gcc版本为5.3.0 这是C++程序: #include<iostream> #include<cmath> #include<fstream> using namespace std; int main() { cout<<sin(1); }

C+的编译错误+;(马科斯) 当我试图在MAC中编译这个非常简单的C++程序时,我得到了一个错误(HysieRa:Voice 10:133)。此Mac中使用的gcc版本为5.3.0 这是C++程序: #include<iostream> #include<cmath> #include<fstream> using namespace std; int main() { cout<<sin(1); },c++,macos,gcc,compilation,g++,C++,Macos,Gcc,Compilation,G++,我得到以下错误: /var/folders/mp/z7xpkw3538z71904cdqhztv00000gn/T//ccGJEHr7.s:24:11: warning: section "__textcoal_nt" is deprecated .section __TEXT,__textcoal_nt,coalesced,pure_instructions ^ ~~~~~~~~~~~~~ /var/folders/mp/z7xpkw3538z719

我得到以下错误:

/var/folders/mp/z7xpkw3538z71904cdqhztv00000gn/T//ccGJEHr7.s:24:11: warning: section "__textcoal_nt" is deprecated
    .section __TEXT,__textcoal_nt,coalesced,pure_instructions
             ^      ~~~~~~~~~~~~~
/var/folders/mp/z7xpkw3538z71904cdqhztv00000gn/T//ccGJEHr7.s:24:11: note: change section name to "__text"
    .section __TEXT,__textcoal_nt,coalesced,pure_instructions
             ^      ~~~~~~~~~~~~~
Undefined symbols for architecture x86_64:
  "std::basic_ostream<char, std::char_traits<char> >::operator<<(double)", referenced from:
      _main in ccpjcybF.o
  "std::ios_base::Init::Init()", referenced from:
      __static_initialization_and_destruction_0(int, int) in ccpjcybF.o
  "std::ios_base::Init::~Init()", referenced from:
      __static_initialization_and_destruction_0(int, int) in ccpjcybF.o
  "std::cout", referenced from:
      _main in ccpjcybF.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
/var/folders/mp/z7xpkw3538z71904cdqhztv00000gn/T//ccJjEuJy.s:24:11: warning: section "__textcoal_nt" is deprecated
    .section __TEXT,__textcoal_nt,coalesced,pure_instructions
             ^      ~~~~~~~~~~~~~
/var/folders/mp/z7xpkw3538z71904cdqhztv00000gn/T//ccJjEuJy.s:24:11: note: change section name to "__text"
    .section __TEXT,__textcoal_nt,coalesced,pure_instructions
             ^      ~~~~~~~~~~~~~
现在,我得到以下错误:

/var/folders/mp/z7xpkw3538z71904cdqhztv00000gn/T//ccGJEHr7.s:24:11: warning: section "__textcoal_nt" is deprecated
    .section __TEXT,__textcoal_nt,coalesced,pure_instructions
             ^      ~~~~~~~~~~~~~
/var/folders/mp/z7xpkw3538z71904cdqhztv00000gn/T//ccGJEHr7.s:24:11: note: change section name to "__text"
    .section __TEXT,__textcoal_nt,coalesced,pure_instructions
             ^      ~~~~~~~~~~~~~
Undefined symbols for architecture x86_64:
  "std::basic_ostream<char, std::char_traits<char> >::operator<<(double)", referenced from:
      _main in ccpjcybF.o
  "std::ios_base::Init::Init()", referenced from:
      __static_initialization_and_destruction_0(int, int) in ccpjcybF.o
  "std::ios_base::Init::~Init()", referenced from:
      __static_initialization_and_destruction_0(int, int) in ccpjcybF.o
  "std::cout", referenced from:
      _main in ccpjcybF.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
/var/folders/mp/z7xpkw3538z71904cdqhztv00000gn/T//ccJjEuJy.s:24:11: warning: section "__textcoal_nt" is deprecated
    .section __TEXT,__textcoal_nt,coalesced,pure_instructions
             ^      ~~~~~~~~~~~~~
/var/folders/mp/z7xpkw3538z71904cdqhztv00000gn/T//ccJjEuJy.s:24:11: note: change section name to "__text"
    .section __TEXT,__textcoal_nt,coalesced,pure_instructions
             ^      ~~~~~~~~~~~~~

您可以尝试使用
g++

g++ filename.cpp -o filename.out
clang++ filename.cpp -o filename.out
或者苹果的
clang++

g++ filename.cpp -o filename.out
clang++ filename.cpp -o filename.out

您可以尝试使用
g++

g++ filename.cpp -o filename.out
clang++ filename.cpp -o filename.out
或者苹果的
clang++

g++ filename.cpp -o filename.out
clang++ filename.cpp -o filename.out

您正在使用
gcc
编译C源代码


这就是问题所在,您应该改用
g++

您正在使用
gcc
编译C源代码

这就是问题所在,您应该改用
g++