fakeh
June 21st, 2006, 11:15 AM
I have recently upgraded breezy to dapper in the automated way. Unfortunately the latest kernel does not boot and gets stuck at loading hald. So I'm still using the 2.6.12-10-386 kernel. Anyway, this seems to have broken gcc's ability to compile code. For a long time I assumed that I was simply writing guff code, however, I began to suspect that there was something wrong with my configuration or that I am now missing some library.
#include <iostream>
#include <iomanip>
#include <fstream>
using namespace std;
int main() {
int sum = 0;
int x;
ifstream inFile;
inFile.open("test.txt");
if (!inFile) {
cout << "Unable to open file";
exit(1); // terminate with error
}
while (inFile >> x) {
sum = sum + x;
}
inFile.close();
cout << "Sum = " << sum << endl;
return 0;
}
For example (taken from http://www.fredosaurus.com/notes-cpp/io/readtextfile.html) gives the same sort of errors I was receiving with my own code.
E.g.
/tmp/ccExYIui.o: In function `main':tst.cpp:(.text+0x31): undefined reference to `std::basic_ifstream<char, std::char_traits<char> >::basic_ifstream()'
:tst.cpp:(.text+0x4f): undefined reference to `std::basic_ifstream<char, std::char_traits<char> >::open(char const*, std::_Ios_Openmode)'
:tst.cpp:(.text+0x62): undefined reference to `std::basic_ios<char, std::char_traits<char> >::operator!() const'
:tst.cpp:(.text+0x75): undefined reference to `std::cout'
etc.
I'm guessing that I'm missing some libraries that were upgraded and I need to install backdated packages??
Many thanks for any help provided,
Dan.
#include <iostream>
#include <iomanip>
#include <fstream>
using namespace std;
int main() {
int sum = 0;
int x;
ifstream inFile;
inFile.open("test.txt");
if (!inFile) {
cout << "Unable to open file";
exit(1); // terminate with error
}
while (inFile >> x) {
sum = sum + x;
}
inFile.close();
cout << "Sum = " << sum << endl;
return 0;
}
For example (taken from http://www.fredosaurus.com/notes-cpp/io/readtextfile.html) gives the same sort of errors I was receiving with my own code.
E.g.
/tmp/ccExYIui.o: In function `main':tst.cpp:(.text+0x31): undefined reference to `std::basic_ifstream<char, std::char_traits<char> >::basic_ifstream()'
:tst.cpp:(.text+0x4f): undefined reference to `std::basic_ifstream<char, std::char_traits<char> >::open(char const*, std::_Ios_Openmode)'
:tst.cpp:(.text+0x62): undefined reference to `std::basic_ios<char, std::char_traits<char> >::operator!() const'
:tst.cpp:(.text+0x75): undefined reference to `std::cout'
etc.
I'm guessing that I'm missing some libraries that were upgraded and I need to install backdated packages??
Many thanks for any help provided,
Dan.