473,387 Members | 1,834 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Why am I getting these errors?

9
I get two error when I try to compile my code.
For this line:
if(it->getName == nam)

it tells me (No match for the 'operator=='in it.std::_List_Iterator<TP>::operator ->[with_TP= record]0->record::getName==nam )

and for this line:
int addRecord( list< record >& database )
{
I get, a function-definition is not allowed here berofe '{' token.

Can anyone explain to me why I'm getting these errors.
Thank you!

Expand|Select|Wrap|Line Numbers
  1. //returns a valid iterator if name is used already otherwise is returns 0
  2. list< record> :: iterator existName(list <record> & database, const string& nam)
  3. {
  4.     list <record>::iterator it;
  5.  
  6.     for (it = database.begin(); it != database.end(); it++) 
  7.     {
  8.         if(it->getName == nam)
  9.         {
  10.             return it;
  11.         }
  12.         return database.end();
  13.     }
  14.  
  15. //add database records to end of list
  16. //gets input from the keyboard
  17. int addRecord( list< record >& database )
  18. {
  19.     cout << "Enter a blank to exit the list :" <<endl;
  20.     int count = 0, reply;
  21.     string nam;
  22.     for (;;)//loops until break 
  23.     {
  24.         cout << "Name :";
  25.         getline(cin,nam);
  26.         if (nam == "") 
  27.         {
  28.             break;
  29.         }
  30.         //create and add the record to the end of the list
  31.         database.push_back(record(nam));
  32.         cout << "Record added " << endl;
  33.         }
  34.     return count;
  35. }
  36.  
Aug 5 '10 #1
2 1195
Banfa
9,065 Expert Mod 8TB
Is getName actually a method, should you have a method call?

it->getName()

After line 13 you are missing a } (and a return statement.
Aug 5 '10 #2
tam13
9
Thank you for the quick response!
Aug 6 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: ChrisH | last post by:
Is there a way in python to run a DOS command and have it return any errors that occur? I've tried some of the different versions of peopen as well as the code listed below and none of them give me...
0
by: Jeff Leckrone | last post by:
Hi. I am running a replicated Access 2003 database on our Windows terminal server. I put the copies on the network so that the users that need to access them can see them. When they opened their...
0
by: Steve D | last post by:
Following up a message I posted yesterday, I am writing a program using Process.GetProcesses(remotecomputername) to monitor processes on other computers in a network. It seems to work fine for some...
6
by: srikar | last post by:
When the below function was run on linux64 bit machine in C++ i am getting the following problems. void real_rec::dump(ostream& s, const int indent ) const { s << "real = "; long f =...
1
by: sshankar | last post by:
Hi, New to Stored procedure. Basically just installed DB2 v8.1.0.36 Was trying to build a stored procedure.. It is giving following error.. Looks like some error related to configuration...
2
by: Manikandan | last post by:
Hi, I have a program written in .Net Framework 1.1 using Visual studio enterprise edition 2003. I tried compiling the same program in visual c# express edition 2005. I'm getting following...
3
by: dazzler | last post by:
Please tell me why I get errors while compiling my code with GCC =( #include <stdio.h> int a; a = 12; a = 9; a = 14;
0
by: Jack | last post by:
Since I don't have VS2003, I'm trying to build cjson with MingW and Cygwin but I'm getting lots of errors like these: build\temp.win32-2.5\Release\cjson.o(.text+0x8e):cjson.c: undefined...
0
banning
by: banning | last post by:
hi i've been trying all day to install soap and its getting really annoying... the extension_dir is set up correctly... i have written in my ini file extension=php_soap.dll and there is a file that...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.