gcc编译问题,急!
编译一个helloworld的时候出现的
In file included from /usr/lib/gcc/i386-redhat-linux/4.0.0/../../../../include/c++/4.0.0/backward/iostream.h:31,
from /projects/cpp/demo.cpp:1:
/usr/lib/gcc/i386-redhat-linux/4.0.0/../../../../include/c++/4.0.0/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <iostream> instead of the deprecated header <iostream.h>. To disable this warning use -Wno-deprecated.
/tmp/cc1RwdZf.o(.text+0x25): In function `main':
demo.cpp: undefined reference to `std::cout'
/tmp/cc1RwdZf.o(.text+0x2a):demo.cpp: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std:perator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
/tmp/cc1RwdZf.o(.text+0x47): In function `__tcf_0':
demo.cpp: undefined reference to `std::ios_base::Init::~Init()'
/tmp/cc1RwdZf.o(.text+0x74): In function `__static_initialization_and_destruction_0(int, int)':
demo.cpp: undefined reference to `std::ios_base::Init::Init()'
/tmp/cc1RwdZf.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
collect2: ld 返回 1
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(9)
加一句 using namespace std ;
[oracle@Linux1 c_lang]$ g++ -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.3/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --host=i386-redhat-linux
Thread model: posix
gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-20)
[oracle@Linux1 c_lang]$ g++ t1.cpp
t1.cpp: In function `int main()':
t1.cpp:4: `cout' undeclared (first use this function)
t1.cpp:4: (Each undeclared identifier is reported only once for each function
it appears in.)
t1.cpp:4: `endl' undeclared (first use this function)
你的程序怎么写的?
我写的程序test.cpp是这样的:
复制代码
# g++ test.cpp
#./a.out
aaaa
把源程序中的头文件改成C++中的标准头文件试试。
用g++编译结果也是一样啊
我以前编译的时候是可以的啊
怎么也不会把iostream.h deprecated吧
是C++程序吧?
用g++编译.
gcc -o demo demo.cpp
怎么编译的?