极端新手 - 你好世界的错误

use*_*843 0 c++

使用B. Stroustrup的编程文本和关于pg 50的'hello world'程序会产生错误.我有"std_lib_facilities.h"包含文件的问题.

运行后(以root身份)'gcc hworld1.cpp'输出为 -

In file included from /usr/include/c++/4.4/ext/hash_map:60,
             from std_lib_facilities.h:34,
             from hworld1.cpp:1:
/usr/include/c++/4.4/backward/backward_warning.h:28: warning: #warning This file     includes at least one deprecated or antiquated header which may be removed without further notice at a future date. Please use a non-deprecated interface with equivalent functionality instead. For a listing of replacement headers and interfaces, consult the file backward_warning.h. To disable this warning use -Wno-deprecated.
/tmp/ccpwXUYx.o: In function `main':
hworld1.cpp:(.text+0x14): undefined reference to `std::cout'
hworld1.cpp:(.text+0x19): 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*)'
/tmp/ccpwXUYx.o: In function `__static_initialization_and_destruction_0(int, int)':
hworld1.cpp:(.text+0x41): undefined reference to `std::ios_base::Init::Init()'
hworld1.cpp:(.text+0x46): undefined reference to `std::ios_base::Init::~Init()'
/tmp/ccpwXUYx.o:(.eh_frame+0x12): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status
Run Code Online (Sandbox Code Playgroud)

任何建议如何修复文件,也许注释掉哈希部分?

兴奋到最后有时间开始,但这似乎比第一个故障排除任务大一点.我试过使用iostream作为包含.我在Ubuntu 11.04上运行它.也许我需要更新gcc或使用g ++.不知道是什么可以让我轻松过去.我用'使用... std'和...做了一些事情,作为我不记得的合适的名字(哎呀).任何人都知道权利包括.

这是代码 -

#include "std_lib_facilities.h"

int main()
{
    cout<<"hiya people\n";
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

Mac*_*iej 6

你应该使用g ++,因为gcc是C编译器(而不是C++).