// This is LMInterpolate.cc. #include #include #include using namespace std; using std::cout; using std::endl; using std::cerr; int main () { string line; ifstream lmfile ("lmprobs1"); if (lmfile.is_open()) { while(! lmfile.eof() ) { getline (lmfile,line); cout << line << endl; } lmfile.close(); } else cout << "Unable to open file."; return 0; } ----- // This is the result of trying to compile it. moba:module2a-practical$ gcc LMInterpolate.cc -o LMInterpolate /tmp/ccLDt1Jg.o: In function `__static_initialization_and_destruction_0(int, int)': LMInterpolate.cc:(.text+0x23): undefined reference to `std::ios_base::Init::Init()' /tmp/ccLDt1Jg.o: In function `__tcf_0': LMInterpolate.cc:(.text+0x6c): undefined reference to `std::ios_base::Init::~Init()' /tmp/ccLDt1Jg.o: In function `main': LMInterpolate.cc:(.text+0x8e): undefined reference to `std::basic_string, std::allocator >::basic_string()' LMInterpolate.cc:(.text+0xac): undefined reference to `std::basic_ifstream >::basic_ifstream(char const*, std::_Ios_Openmode)' LMInterpolate.cc:(.text+0xba): undefined reference to `std::basic_ifstream >::is_open()' LMInterpolate.cc:(.text+0xd5): undefined reference to `std::basic_istream >& std::getline, std::allocator >(std::basic_istream >&, std::basic_string, std::allocator >&)' LMInterpolate.cc:(.text+0xe3): undefined reference to `std::cout' LMInterpolate.cc:(.text+0xe8): undefined reference to `std::basic_ostream >& std::operator<< , std::allocator >(std::basic_ostream >&, std::basic_string, std::allocator > const&)' LMInterpolate.cc:(.text+0xf0): undefined reference to `std::basic_ostream >& std::endl >(std::basic_ostream >&)' LMInterpolate.cc:(.text+0xf8): undefined reference to `std::basic_ostream >::operator<<(std::basic_ostream >& (*)(std::basic_ostream >&))' LMInterpolate.cc:(.text+0x10b): undefined reference to `std::basic_ios >::eof() const' LMInterpolate.cc:(.text+0x120): undefined reference to `std::basic_ifstream >::close()' LMInterpolate.cc:(.text+0x131): undefined reference to `std::cout' LMInterpolate.cc:(.text+0x136): undefined reference to `std::basic_ostream >& std::operator<< >(std::basic_ostream >&, char const*)' LMInterpolate.cc:(.text+0x14e): undefined reference to `std::basic_ifstream >::~basic_ifstream()' LMInterpolate.cc:(.text+0x16a): undefined reference to `std::basic_ifstream >::~basic_ifstream()' LMInterpolate.cc:(.text+0x17d): undefined reference to `std::basic_string, std::allocator >::~basic_string()' LMInterpolate.cc:(.text+0x1a2): undefined reference to `std::basic_string, std::allocator >::~basic_string()' /tmp/ccLDt1Jg.o:(.eh_frame+0x12): undefined reference to `__gxx_personality_v0' collect2: ld returned 1 exit status