LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 856|回复: 4

第一次用gcc,出错了,上来问一下.

[复制链接]
发表于 2004-5-15 13:03:35 | 显示全部楼层 |阅读模式
一个程序,在windows下用VC++编译过了.
在windows下E盘,mount过来后,用gcc编译,报了一大堆错,
是不是没有库函数?
我是新手,一点头绪也没有.请教教我.
下面的报的错.

  1. $ gcc -o 1457 1457.cpp
  2. /tmp/cc6HG0YP.o(.text+0x80): In function `rev_ring(int)':
  3. : undefined reference to `std::cout'
  4. /tmp/cc6HG0YP.o(.text+0x85): In function `rev_ring(int)':
  5. : undefined reference to `std::basic_ostream<char, std::char_traits<char> >::operator<<(int)'
  6. /tmp/cc6HG0YP.o(.text+0x8e): In function `rev_ring(int)':
  7. : undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char)'
  8. /tmp/cc6HG0YP.o(.text+0xb1): In function `rev_ring(int)':
  9. : undefined reference to `std::cout'
  10. /tmp/cc6HG0YP.o(.text+0xb6): In function `rev_ring(int)':
  11. : undefined reference to `std::basic_ostream<char, std::char_traits<char> >::operator<<(int)'
  12. /tmp/cc6HG0YP.o(.text+0xbf): In function `rev_ring(int)':
  13. : undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char)'
  14. /tmp/cc6HG0YP.o(.text+0x19d): In function `main':
  15. : undefined reference to `std::cin'
  16. /tmp/cc6HG0YP.o(.text+0x1a2): In function `main':
  17. : undefined reference to `std::basic_istream<char, std::char_traits<char> >::operator>>(int&)'
  18. /tmp/cc6HG0YP.o(.text+0x1b7): In function `main':
  19. : undefined reference to `std::basic_ios<char, std::char_traits<char> >::operator void*() const'
  20. /tmp/cc6HG0YP.o(.text+0x1d3): In function `main':
  21. : undefined reference to `std::cout'
  22. /tmp/cc6HG0YP.o(.text+0x1d8): In function `main':
  23. : undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char)'
  24. /tmp/cc6HG0YP.o(.text+0x1f8): In function `main':
  25. : undefined reference to `std::cout'
  26. /tmp/cc6HG0YP.o(.text+0x1fd): In function `main':
  27. : undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
  28. /tmp/cc6HG0YP.o(.text+0x206): In function `main':
  29. : undefined reference to `std::basic_ostream<char, std::char_traits<char> >::operator<<(int)'
  30. /tmp/cc6HG0YP.o(.text+0x20f): In function `main':
  31. : undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
  32. /tmp/cc6HG0YP.o(.text+0x2c0): In function `__static_initialization_and_destruction_0(int, int)':
  33. : undefined reference to `std::ios_base::Init::Init[in-charge]()'
  34. /tmp/cc6HG0YP.o(.text+0x2ef): In function `__tcf_0':
  35. : undefined reference to `std::ios_base::Init::~Init [in-charge]()'
  36. /tmp/cc6HG0YP.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
  37. collect2: ld returned 1 exit status
复制代码
发表于 2004-5-15 14:39:23 | 显示全部楼层

回复: 第一次用gcc,出错了,上来问一下.

不會吧﹐大?。VC下面的東西拿到GCC下編譯也要考慮修改一下啊﹐呵呵。

undefined reference to `std::cout'
undefined reference to `std::cin'

不知道GCC下有沒有這種說法
发表于 2004-5-15 15:48:40 | 显示全部楼层
g++ -o 1457 1457.cpp
 楼主| 发表于 2004-5-15 18:04:58 | 显示全部楼层
哦,原来是用g++啊.是不是编译C++的就用g++?
呵呵,就那么一点点小小的差别,
谢谢指教.
发表于 2004-5-15 20:58:05 | 显示全部楼层
请搜索论坛.
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表