Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > C++ Programming
|
C++ Programming General discussions for the C++ language. For questions specific to Microsoft's Visual C++ variant, see the Visual C++ forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C++ Programming section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old January 14th, 2006, 01:10 AM
Registered User
 
Join Date: Jan 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to tanchonghui
Default A problem from Professional C++ by Solter,Kepler

Hi. Can anyone help with this?

I implemented the code found on p.29 - 41 of the book "Professional C++" by Solter and Kepler.

My C++ compiler gives the following error message when it's compiling Database:
__________________________________________________ ___________________
Employee& Database::getEmployee(string inFirstName, string inLastName)
        ^

Database.cpp(51): Warning 18: implied return of Records::Database::getEmployee at closing '}' does not return value

void Database::displayAll()
   ^

Database.cpp(64): Warning 18: implied return of Records::Database::getEmployee at closing '}' does not return value
__________________________________________________ ___________________

These were the first lines of the error message. There were a few more lines. I can't figure out what's wrong.

Any advise?

Will be greatly appreciated.

tanchonghui
Reply With Quote
  #2 (permalink)  
Old January 28th, 2006, 08:12 PM
Authorized User
 
Join Date: Oct 2004
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default

It looks like your compiler is having issues with the fact that getEmployee() throws an exception on the last line and doesn't return a value. Since the exception is thrown, no return value should be necessary.

To get it to compile, you can add this as the last line of that method:

return mEmployees[0];

Note that that line will never actually be executed.

I'm curious to know what compiler/verison you're using...

----
Scott J. Kleper
Author, "Professional C++"
(Wrox, 2005)
Reply With Quote
  #3 (permalink)  
Old January 28th, 2006, 11:42 PM
Authorized User
 
Join Date: Nov 2005
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default

we need code to debug problem correctly

Reply With Quote





Similar Threads
Thread Thread Starter Forum Replies Last Post
problem with code to "Professional Java Data superea_net Java Databases 0 August 1st, 2006 07:07 AM
Professional PHP5 p25 Interface Problem mercury7 Beginning PHP 0 January 13th, 2006 03:18 AM
Professional ASP XMl Case study 3 problem ammo1981 Classic ASP XML 0 January 27th, 2004 10:09 AM
Professional C# rajivthakur Wrox Book Feedback 0 November 5th, 2003 07:05 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.