加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c – clang iostream – 没有找到符号

发布时间:2020-12-16 03:05:18 所属栏目:百科 来源:网络整理
导读:所以我试图让cl编译器工作..我自然的首选程序是以下非常复杂的代码: #include iostreamusing std::cout; using std::endl;/* hello world.cpp */int main(){ cout "Hello,world!" endl; return 0;} 在命令行我做了:clang helloworld.cpp和我得到以下很好的
所以我试图让cl编译器工作..我自然的首选程序是以下非常复杂的代码:
#include <iostream>
using std::cout;    using std::endl;
/* hello world.cpp */
int main()
{
    cout << "Hello,world!" << endl;
    return 0;
}

在命令行我做了:clang helloworld.cpp和我得到以下很好的错误:

Undefined symbols for architecture x86_64:
  "std::ios_base::Init::~Init()",referenced from:
      ___cxx_global_var_init in cc-4iziZq.o
  "std::ios_base::Init::Init()",referenced from:
      ___cxx_global_var_init in cc-4iziZq.o
  "std::basic_ostream<char,std::char_traits<char> >& std::endl<char,std::char_traits<char> >(std::basic_ostream<char,std::char_traits<char> >&)",referenced from:
      _main in cc-4iziZq.o
  "std::cout",referenced from:
      _main in cc-4iziZq.o
  "std::basic_ostream<char,std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char,std::char_traits<char> >&,char const*)",referenced from:
      _main in cc-4iziZq.o
  "std::ostream::operator<<(std::ostream& (*)(std::ostream&))",referenced from:
      _main in cc-4iziZq.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

哪里不对?
谢谢!
-kstruct

解决方法

clang是一个C编译器.您需要使用clang或使用-x c标志.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读