This is the mail archive of the libstdc++@sourceware.cygnus.com mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

seg fault with IO



Hi all.

When I try to run a file, linked with the new libstdc++, that uses
ifstream for IO, the program cores right away. The same program linked
with the default libstdc++ that comes with gcc 2.95.2 works without a
flaw.


I use the follow command to create the executable:

g++ -o read read.cc -I/z/opt/libstdc++-2.90.6/include/g++-v3
-L/z/opt/libstdc++-2.90.6/lib


It seems to have linked with the right library:

-gcc- [gerald c]$ ldd read
	libstdc++.so.3 => /z/opt/libstdc++-2.90.6/lib/libstdc++.so.3
	(0x2aaac000)
	libm.so.6 => /lib/libm.so.6 (0x2ab8e000)
	libc.so.6 => /lib/libc.so.6 (0x2abac000)
	/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x55555000)


When I try to run it:

-gcc- [gerald c]$ ./read
Segmentation fault


libstdc++ installed without any problems and make check worked just
fine. I don't understand. I've included the source code below in case
it's my program's fault. If anyone can help, I would appreciate it
very much.


Thanks.



#include <fstream>
using namespace std;

int
main(int ac, char* av[])
{
    ifstream ifs("read.cc");
    char ch;
    ifs.read(&ch, 1);
    return 0;
}

    


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]