| | |
Program crashes question
Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Apr 2009
Posts: 10
Reputation:
Solved Threads: 0
I have a program which is supposed to find the shortest path between airports and users' flight data to find the shortest path between airports; that is, the airports are the nodes and the flights are the edges.
I've not started to implement the algorithm as yet but I am working on the implementation of the airports and the flights.
Unfortunately, my program crashes when I am testing. I've put in debug statements in the code to find out where and why it's crashing but, unfortunately, I'm having a hard time.
I am going to attach the files if anyone could please tell me where I've gone wrong that would be greatly appreciated. Thanks.
I've not started to implement the algorithm as yet but I am working on the implementation of the airports and the flights.
Unfortunately, my program crashes when I am testing. I've put in debug statements in the code to find out where and why it's crashing but, unfortunately, I'm having a hard time.
I am going to attach the files if anyone could please tell me where I've gone wrong that would be greatly appreciated. Thanks.
Well, your program crashed. It looks like a mere assertion, not a question.
Read This Before Posting: http://www.daniweb.com/forums/thread78223.html.
Never send exe files in attachments!
Read This Before Posting: http://www.daniweb.com/forums/thread78223.html.
Never send exe files in attachments!
•
•
Join Date: Dec 2007
Posts: 360
Reputation:
Solved Threads: 69
After inspecting airports.cpp of your source code I recommend that you read a good C++ book. A std::vector of objects member variable doesn't need any initialization in the ctor and no destruction in the dtor. And what the hell do you want to destroy with
?
C++ Syntax (Toggle Plain Text)
flights.~vector();
If you are forced to reinvent the wheel at least try to invent a better one!
Please use code tags - Please mark solved threads as solved
Please use code tags - Please mark solved threads as solved
•
•
Join Date: Apr 2009
Posts: 10
Reputation:
Solved Threads: 0
•
•
•
•
Well, your program crashed. It looks like a mere assertion, not a question.
Read This Before Posting: http://www.daniweb.com/forums/thread78223.html.
Never send exe files in attachments!
•
•
Join Date: Apr 2009
Posts: 10
Reputation:
Solved Threads: 0
•
•
•
•
After inspecting airports.cpp of your source code I recommend that you read a good C++ book. A std::vector of objects member variable doesn't need any initialization in the ctor and no destruction in the dtor. And what the hell do you want to destroy with
?C++ Syntax (Toggle Plain Text)
flights.~vector();
May you please help me a little more so i can get this working and understand were i have gone wrong.
There is an error in the airport1.txt file on line 90
getline() reads it in as
You can't explicitly call a c++ class's destructor like that because it will crash your program.
SYD BNE 07:30 1:00 getline() reads it in as
SYD BNE07:30 1:00 -- missing the space between BNE and 07:30. I re-typed the line and the program continued to work from there until the next error, which was at the destructor C++ Syntax (Toggle Plain Text)
AllAirports::~AllAirports() { airports.~map(); }
You can't explicitly call a c++ class's destructor like that because it will crash your program.
•
•
Join Date: Apr 2009
Posts: 10
Reputation:
Solved Threads: 0
•
•
•
•
There is an error in the airport1.txt file on line 90
SYD BNE 07:30 1:00
getline() reads it in asSYD BNE07:30 1:00-- missing the space between BNE and 07:30. I re-typed the line and the program continued to work from there until the next error, which was at the destructor
C++ Syntax (Toggle Plain Text)
AllAirports::~AllAirports() { airports.~map(); }
You can't explicitly call a c++ class's destructor like that because it will crash your program.
Last edited by ippomarley; Jun 15th, 2009 at 8:56 am. Reason: mistake in grammer
•
•
Join Date: Apr 2009
Posts: 10
Reputation:
Solved Threads: 0
•
•
•
•
The secret is using a great compiler's IDE, such as VC++ 2008 Express, and learning how to debug programs.
What else can i do to improve?
Thank very much i appreciate it.
![]() |
Similar Threads
- Program crashes when I use SetWindowText(); (C++)
- Problem decompressing file (C++)
- Program crashes after running... (C++)
- program crashes immediately when opening - HJT log included... (Viruses, Spyware and other Nasties)
- program crashes (C++)
- quick question w\ a program (Java)
- possibly ignorant question about the stack (C)
- WIn XP Crashes (Windows NT / 2000 / XP)
Other Threads in the C++ Forum
- Previous Thread: missing type specifier - C++ does not support default-int
- Next Thread: Problem with ifstream returning fail()
| Thread Tools | Search this Thread |
api array based binary c++ c/c++ calculator char char* class classes code coding compile console conversion count database delete deploy desktop developer directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp iamthwee ifstream input int integer java lib linkedlist linker linux list loop looping loops map math matrix memory multiple news number numbertoword output pointer problem program programming project python random read recursion recursive reference return rpg sorting string strings struct temperature template templates test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock wordfrequency wxwidgets






