Help - Segment fault in my simple program
From: Neo (neo_in_matrix_at_msn.com)
Date: 01/29/04
- Next message: Sybren Stuvel: "Re: Help - Segment fault in my simple program"
- Previous message: Sybren Stuvel: "Re: Is there anything like Dreamweaver under Linux?"
- Next in thread: Sybren Stuvel: "Re: Help - Segment fault in my simple program"
- Reply: Sybren Stuvel: "Re: Help - Segment fault in my simple program"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 29 Jan 2004 06:22:23 -0800
Here is the source of my simple program:
#include <stdio.h>
#include <stdlib.h>
#include <ncurses.h>
#include <iostream>
#include <list>
using namespace std;
// prototypes
void test_list();
int main()
{
test_list();
cout << "Press any key to end..." << endl;
getch();
return 0;
}
void test_list()
{
list<int> l;
l.push_back(1);
l.push_front(2);
l.push_back(3);
l.push_back(4);
l.push_back(5);
list<int>::const_iterator it;
for(it = l.begin(); it != l.end(); it++)
{
cout << *it << endl;
}
}
I use
g++ -ot -lncurses test.cpp
to compile the program.
Every time I run the program, I get:
2
1
3
4
5
Press any key to end...
Segmentation fault
Can anyone please test my program on his/her computer and tell me if
the result is the same. Thanks.
- Next message: Sybren Stuvel: "Re: Help - Segment fault in my simple program"
- Previous message: Sybren Stuvel: "Re: Is there anything like Dreamweaver under Linux?"
- Next in thread: Sybren Stuvel: "Re: Help - Segment fault in my simple program"
- Reply: Sybren Stuvel: "Re: Help - Segment fault in my simple program"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|