Advertisement

04.29.2008 at 09:16AM PDT, ID: 23362559 | Points: 500
[x]
Attachment Details
CXX0030 C++ run-time debugging error
Tags: C++
I get a CXX0030 run-time error (Microsoft Visual Studio 2008, C++) off executing the outputShortestPath method of the ShortestPath (derived from Graph) class, that call is in main.cpp on line 290. The method outputShortestPath calls the function getPrior of the Vertex class, shortestpath.h on line 156, now the problem here seems to be when the operator= overload executes for the Vertex class (graph.h line 577) , getPrior accesses a pointer call prior that points to a different Vertex. Prior needs to be dereferenced and assigned to the Vertex<type>&. Inside the operaotr=, there is access issues, but if I switch out that 'rightVertex.protectedMember' for a function 'rightVertex.getProtectedMember()', then the problem dives further, and in the accessor (isSource() graph.h, line 506), that has one line, and just returns the protected member, that one line is the break point for CXX0030 i've traced down to, Error: expression cannot be evaluated.

Anyone very skilled with MS VS 2008 debugger can probably identify this, or someone who has seen this before. I understand the files I've attached have a few lines of code in them, but I've tried to nail the issue down above.
Attachments:
 
ShortestPath<type> derived from Graph<type> which has-a vector of Vertex<type> which has a vector of Edge<type>
 
 
Graph<type>
 
 
test program
 
Start your free trial to view this solution
Question Stats
Zone: Programming
Question Asked By: justinvoels
Question Asked On: 04.29.2008
Participating Experts: 1
Points: 500
Views: 0
Translate:
Loading Advertisement...
04.29.2008 at 09:23AM PDT, ID: 21463721

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
04.29.2008 at 09:34AM PDT, ID: 21463802

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
04.29.2008 at 09:58AM PDT, ID: 21464025

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
04.29.2008 at 10:03AM PDT, ID: 21464076

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.01.2008 at 09:57AM PDT, ID: 21480399

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.01.2008 at 10:04AM PDT, ID: 21480471

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.01.2008 at 12:40PM PDT, ID: 21481929

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.01.2008 at 07:34PM PDT, ID: 21484236

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.01.2008 at 09:06PM PDT, ID: 21484470

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.12.2008 at 10:32AM PDT, ID: 21548897

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
Microsoft
  • Internet Protocols
  • Applications
  • Development
  • OS
  • Hardware
  • Windows Security
Apple
  • Operating Systems
  • Hardware
  • Programming
  • Networking
  • Software
Internet
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Spy / Ad Blockers
  • Web Browsers
  • New Net Users
  • Web Development
  • Chat / IM
  • Anti Spam
  • Web Servers
  • Anti-Virus
  • Email Clients
Gamers
  • Tips
  • Online / MMORPG
  • Puzzle
  • Emulators
  • Action / Adventure
  • Role Playing
  • Consoles
  • Game Programming
  • Strategy
  • Sports
  • Misc
  • Computer Games
Digital Living
  • Hardware
  • New Net Users
  • New Users
  • Software
  • Digital Music
  • Gaming World
  • Home Security
  • Apple
  • Networking Hardware
Virus & Spyware
  • Vulnerabilities
  • IDS
  • Encryption
  • Anti-Virus
  • Operating Systems Security
  • Software Firewalls
  • WebApplications
  • Cell Phones
  • Operating Systems
  • Internet
  • Hardware Firewalls
Hardware
  • Handhelds / PDAs
  • Displays / Monitors
  • Components
  • Networking Hardware
  • Peripherals
  • Laptops/Notebooks
  • Storage
  • Servers
  • Desktops
  • New Users
  • Misc
  • Apple
Software
  • System Utilities
  • Industry Specific
  • Network Management
  • Photos / Graphics
  • Page Layout
  • VMWare
  • Misc
  • Web Development
  • OS
  • CYGWIN
  • Voice Recognition
  • Message Queue
  • Quality Assurance
  • Security
  • Firewalls
  • MultiMedia Applications
  • Development
  • Database
  • Office / Productivity
  • Business Management
  • OS/2 Apps
  • Server Software
  • Internet / Email
ITPro
  • OS
  • Storage
  • Encryption
  • Operating Systems Security
  • Apple Hardware
  • Laptops & Notebooks
  • Servers
  • Networking Hardware
  • Peripherals
  • Devices
  • Displays / Monitors
  • WebTrends / Stats
  • Search Engines
  • Firewalls
  • WebApplications
  • IDS
  • Vulnerabilities
  • Email Clients
  • File Sharing
  • Spy / Ad Blockers
  • Web Browsers
  • Web Servers
  • Networking
  • Anti-Virus
  • Chat / IM
  • Anti Spam
Developer
  • Web Servers
  • Web Browsers
  • Game Programming
  • Dev Tools
  • Industry Specific
  • Office / Productivity
  • Database
  • CYGWIN
  • Web Development
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Programming
  • Content Management
  • Application Servers
  • Protocols
Storage
  • Removable Backup Media
  • Storage Technology
  • Servers
  • Grid
  • Remote Access
  • Backup / Restore
  • Misc
  • Hard Drives
OS
  • Miscellaneous
  • Security
  • Development
  • Linux
  • VMWare
  • MainFrame OS
  • Unix
  • Apple
  • OS / 2
  • AS / 400
  • BeOS
  • Microsoft
  • VMS / OpenVMS
Database
  • Oracle
  • Miscellaneous
  • MySQL
  • Software
  • Sybase
  • Contact Management
  • PostgreSQL
  • Data Manipulation
  • Clarion
  • InterSystems Cache
  • Siebel
  • MUMPS
  • OLAP
  • SQLBase
  • SAS
  • GIS & GPS
  • 4GL
  • Berkeley DB
  • DB2
  • Informix
  • Interbase / Firebird
  • FoxPro
  • Reporting
  • LDAP
  • Filemaker Pro
  • MS SQL Server
  • dBase
  • MS Access
Security
  • Misc
  • Web Browsers
  • Software Firewalls
  • Operating Systems Security
  • File Sharing
  • Spy / Ad Blockers
  • Vulnerabilities
  • WebApplications
  • IDS
  • Anti-Virus
  • Encryption
  • Anti Spam
  • Email Clients
  • VPN
  • Chat / IM
Programming
  • Editors IDEs
  • Installation
  • Handhelds / PDAs
  • Multimedia Programming
  • System / Kernel
  • Algorithms
  • Game
  • Signal Processing
  • Project Management
  • Open Source
  • Database
  • Misc
  • Languages
  • Processor Platforms
  • Theory
Web Development
  • Scripting
  • Blogs
  • Web Servers
  • Software
  • Search Engines
  • Web Graphics
  • Images
  • Internet Marketing
  • Images and Photos
  • Components
  • Document Imaging
  • Web Languages/Standards
  • Illustration
  • WebApplications
  • Fonts
  • WebTrends / Stats
  • Authoring
  • Digital Camera Software
  • Miscellaneous
Networking
  • Protocols
  • Apple Networking
  • Network Management
  • Message Queue
  • Application Servers
  • Content Management
  • File Servers
  • Email Servers
  • Misc
  • Java Editors & IDEs
  • Wireless
  • Networking Hardware
  • Backup / Restore
  • System Utilities
  • ISPs & Hosting
  • Web Servers
  • Storage Technology
  • Removable Backup Media
  • Servers
  • Broadband
  • Grid
  • OS / 2
  • Novell Netware
  • Unix Networking
  • Windows Networking
  • Security
  • Telecommunications
  • Operating Systems
  • Linux Networking
Other
  • Community Advisor
  • Lounge
  • Community Support
  • New Net Users
  • Philosophy / Religion
  • Math / Science
  • Miscellaneous
  • URLs
  • Expert Lounge
  • Politics
  • Puzzles / Riddles
Community Support
  • Suggestions
  • New to EE
  • New Topics
  • Community Advisor
  • CleanUp
  • Announcements
  • General
  • Feedback
  • Input
  • EE Bugs
 
04.29.2008 at 09:23AM PDT, ID: 21463721
good night!, simply making a temp bool, and copying the data member 'source' to it, and them returning the temp instead of the data member fixes that problem.

Why is that? (C++ has managed to piss me off with ridiculous requirements and particularities regarding OOP than any other language, I personally feel that its no good for OOP, Java is a much better choice, C# even better than Java. C++ needs to stay closer to the hardware, but this course has alot of OOP for using C++)

(Now I have to go through and change every line for the overload, and add accessor functions for any data I wanted to copy in the assignment)
 
04.29.2008 at 09:34AM PDT, ID: 21463802

Rank: Genius

Well, the problem is in the following function:

template <class type>
void ShortestPath<type>::outputShortestPath(const type& source, const type& destination)
{
   //find the shortest paths for source
//   findShortestPaths(source);

   //find the destination vertex in vertices (Graph<type> private member)
   Vertex<type> destinationVertex,temp;

   for(unsigned int i = 0; i < vertices.size(); i++)
   {
      if(vertices[i].getInfo() == source)
      {
         destinationVertex = vertices[i];
         break;
      }

   }

   if(destinationVertex.isSource())
   {
      cerr << "OK\n";
   }
   else
   {
      cerr << "ahhh crap\n";
   }

   //work backwards from destination until source
   destinationVertex.printInfo(); cout << endl;
   destinationVertex.getPrior(temp); // <------------ here
   temp.printInfo(); cout << endl;

}

The marked line above uses

template <class type>
void Vertex<type>::getPrior(Vertex<type>& v)
{
   v = *prior;
}

with 'prior' being NULL in 'destinationVertex' - you should check that before dereferencing a NULL pointer.
 
04.29.2008 at 09:58AM PDT, ID: 21464025
Error      1      error C2679: binary '=' : no operator found which takes a right-hand operand of type 'const Vertex<type>' (or there is no acceptable conversion)      c:\program files\microsoft visual studio 9.0\vc\include\xutility      3133      296a8

After I made the changes necessary (first comment), I get the above error. I went back and changed what you mentioned to not dereference a NULL pointer. I do not even know what xutility is
 
04.29.2008 at 10:03AM PDT, ID: 21464076

Rank: Genius

I'd rather make that

template <class type>
bool Vertex<type>::getPrior(Vertex<type>& v)
{

  if (prior != NULL) {
     v = *prior;
     return true;
  }

   return false;
}

//...

   if (destinationVertex.getPrior(temp)) {
     temp.printInfo(); cout << endl;
  }
 
05.01.2008 at 09:57AM PDT, ID: 21480399
Updated files, the problem is with the operator= and copy constructor for Vertex<type> (in graph.h). They both assign "this" 's source (bool data member) the return of the other Vertex<type>'s isSource() function. When the program does into isSource() for that 'right' Vertex, is cannot seem to access the data member source, return it, or even assign it to a temporary and return that.

If you change the file extentions to .h for the headers and .cpp for main, you can create a win32 console app in visual studio and run the debugger to see what is going on.
 
graph.h
 
 
main()
 
 
shortestpath.h
 
 
05.01.2008 at 10:04AM PDT, ID: 21480471
I realize this question isn't as nice as those 'how do I reverse a string' or 'how do I convert characters to integers ASCII' 500 point questions. If the logic is damaged (which it most likely is), thats one thing, and comes after I can it passed compiling and debugging. If I could have this question worth more, I'd put it at or above 1,000 in a heartbeat.
 
05.01.2008 at 12:40PM PDT, ID: 21481929
The overload for comparisons within priority_queue was incorrect. I am beginning to think I may have a small memory leak associated with the strings contained in my type being stored in the Graph (City, has a string for name).
 
05.01.2008 at 07:34PM PDT, ID: 21484236

Rank: Genius

Sorry for letting you hang in, but this was a holiday here today - will check back tomorrow.
 
05.01.2008 at 09:06PM PDT, ID: 21484470
It's all good, just shuffling through this one, alot of peculiarities I've never encountered/had to worry about.
 
05.12.2008 at 10:32AM PDT, ID: 21548897
The issue lies in the re-heap algorithm, and my use of pointers with priority_queue, and then the algorithm gets applied to them. Maybe I'm missing an overload I should have, but this problem really requires a different approach, a different language (C#, better OOP support), and to strip out the STL classes, and make my own implementations that are worth debugging. That is probably the most important, making my own classes in place of the STL's messy debauchery of C, abstract classes/inheritance/etc., wrappers, and generic algorithms.

Thank-you to those who looked at it.
 
 
20080236-EE-VQP-29 / EE_QW_2_20070628