Sponsored Content
Full Discussion: ISO C++ ambiguous error
Operating Systems Linux Red Hat ISO C++ ambiguous error Post 302766233 by dany2704 on Monday 4th of February 2013 12:08:45 PM
Old 02-04-2013
ISO C++ ambiguous error

String.h has the following operator overloading function which is an user defined
Code:
//declaration
int operator==(char *ch)
//definition
int String::operator==(char *ch)
{
        if (strcmp(_text, ch) == 0)
        {
                return TRUE;
        }
        else
        {
                return FALSE;
        }
}

The above operator overloading function is called in the file Sample.c The g++ compiler throws the following error.
Code:
String.h:67: note: candidate 1: int String::operator==(char*)
Sample.c:230: note: candidate 2: operator==(const char*, const char*) <built-in>
Sample.c:249: error: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:

i have pasted the caller code (sample.c)
Code:
230  if (String(StrInputBuffer.part_string(4)) == ":86:")
     {
       //statement
     }
249  else if (String(StrInputBuffer.part_string(1)) == ":")
     {
     }

I used the below gnu command to compile the source file
Code:
>g++ -c -g Sample.c -o sample 

compiler version:
Target: x86_64-redhat-linux
gcc version 4.1.2 20080704 (Red Hat 4.1.2-54)
Could you please help me to resolve the issue?

Thanks for looking into this

Last edited by Corona688; 02-04-2013 at 01:17 PM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

ambiguous redirect

i have following statement in the script echo -e "$str_XML_col_name:$str_field_type;" >> $i_DC_Key_$i_Tgt_DC_key_Schema here $i_DC_Key is DC key and $i_Tgt_DC_key are the variables............... when i ran the script i am getting error rec_merge.sh: $i_DC_Key_$i_Tgt_DC_key_Schema:... (1 Reply)
Discussion started by: mahabunta
1 Replies

2. Shell Programming and Scripting

getting Ambiguous error on kill -9 @pid from csh

Hello all i have simple script that executing program every 10 seconds im invoke this script as daemon with second script that put it in the background this is my first script (IsAliveTester.csh) #!/bin/csh -f @ iSleep = 10 set processName = "ClientTester" while(1) $processName ... (0 Replies)
Discussion started by: umen
0 Replies

3. Shell Programming and Scripting

`ls -l`: Ambiguous

Hi, I'm trying to code a simple script (c-shell) on a Solaris box and I'm getting an "Ambiguous" error. These are the lines that cause the error: On c-shell: > set var = "" > @ var = `ls -l` `ls -l`: Ambiguous However if I change the second line to: > set var = `ls -l` This works... (2 Replies)
Discussion started by: Guillermo Lopez
2 Replies

4. UNIX for Dummies Questions & Answers

Ambiguous and Command not found Error in UNIX

Hi,All I wrote below script(Example1.sh) and i ran but it giveing error. it's excuted yesterday. SYSTEM_TIME=`date '+%H:%M:%S'` CMP_LOG_TIME=`head -1 runcmp-HINET.log` CMP_ENDED1=`grep 'HINET CMP ended' runcmp-HINET.log` CMP_ENDED2=`echo "HINET CMP ended"` CMP_FAILED2=`echo "HINET... (2 Replies)
Discussion started by: koti_rama
2 Replies

5. Shell Programming and Scripting

Ambiguous and Command not found Error in UNIX

Hi,All I wrote below script(Example1.sh) and i ran but i got error. it's excuted yesterday. SYSTEM_TIME=`date '+%H:%M:%S'` CMP_LOG_TIME=`head -1 runcmp-HINET.log` CMP_ENDED1=`grep 'HINET CMP ended' runcmp-HINET.log` CMP_ENDED2=`echo "HINET CMP ended"` CMP_FAILED2=`echo "HINET CMP... (2 Replies)
Discussion started by: koti_rama
2 Replies

6. Shell Programming and Scripting

Ambiguous output redirect error

Hi everyone, While I was trying to do DATE=`date +"%Y%m%d_%H%M%S"` STARTLOG=$TUXSTDDIR/start_$DATE.log tmboot -y > $STARTLOG 2>&1 I got an error i.e. Ambiguous output redirect error. Here the first part is to boot the account so there is nothing wrong with that.... (6 Replies)
Discussion started by: pareshan
6 Replies

7. Shell Programming and Scripting

ambiguous redirect error

This script has ambiguous redirect error. ... cd $HOME cd folder/work # search all subfolders in work directory find -mindepth 1 -maxdepth 1 -type d | while read directory do CUR_FOLDER="${directory#"./"}" cd $CUR_FOLDER chmod 644 * for ff in *; do if ; then ... (5 Replies)
Discussion started by: candyme
5 Replies

8. Red Hat

How to make boot.iso image from rhel6 installation dvd iso ?

Hello Everyone, Can anyone let me know how to make minimal boot.iso from rhl6 installation dvd iso image. I have a dvd image with me but i want to make just a minimal boot media. Somehow it is not shipped with dvd iso. I know we can download boot.iso from redhat site but is there any anyway we... (5 Replies)
Discussion started by: Rohit Bhanot
5 Replies

9. Shell Programming and Scripting

Ambiguous error

Hello everybody, I just took over this job from someone else and in the past this script they built worked but i recently upgraded from openSuSe 11.4 to 12.1 Now when i run the script i get an ambiguous error at line 25 (the first line after add() ) I have edited out the webpath and any... (1 Reply)
Discussion started by: gumbicus
1 Replies

10. Linux

Ambiguous redirect error and syntax error when using on multiple files

Hi, I need help on following linux bash script. When I linux commands for loop or while loop on individual file it runs great. but now I want the script to run on N number of files so it gives me ambiguous redirect error on line 12 and syntax error on line 22 : (pls help ); #!/bin/bash #... (16 Replies)
Discussion started by: Madhusudan Das
16 Replies
ost::Datetime(3)					     Library Functions Manual						  ost::Datetime(3)

NAME
ost::Datetime - The Datetime class uses a julian date representation of the current year, month, and day and a integer representation of the current time. SYNOPSIS
#include <numbers.h> Inherits ost::Date, and ost::Time. Public Member Functions Datetime (time_t tm) Datetime (tm *dt) Datetime (const char *str, size_t size=0) Datetime (int year, unsigned month, unsigned day, int hour, int minute, int second) Datetime () virtual ~Datetime () char * getDatetime (char *buffer) const time_t getDatetime (void) const bool isValid (void) const Datetime & operator= (const Datetime datetime) Datetime & operator+= (const Datetime &datetime) Datetime & operator-= (const Datetime &datetime) Datetime & operator+= (const Time &time) Datetime & operator-= (const Time &time) int operator== (const Datetime &) int operator!= (const Datetime &) int operator< (const Datetime &) int operator<= (const Datetime &) int operator> (const Datetime &) int operator>= (const Datetime &) bool operator! () const String strftime (const char *format) const Additional Inherited Members Detailed Description The Datetime class uses a julian date representation of the current year, month, and day and a integer representation of the current time. This is then manipulated in several forms and may be exported as needed. Author: Marcelo Dalmas mad@brasmap.com.br Integer based time class. Constructor &; Destructor Documentation ost::Datetime::Datetime (time_ttm) ost::Datetime::Datetime (tm *dt) ost::Datetime::Datetime (const char *str, size_tsize = 0) ost::Datetime::Datetime (intyear, unsignedmonth, unsignedday, inthour, intminute, intsecond) ost::Datetime::Datetime () virtual ost::Datetime::~Datetime () [virtual] Member Function Documentation char* ost::Datetime::getDatetime (char *buffer) const time_t ost::Datetime::getDatetime (void) const bool ost::Datetime::isValid (void) const Reimplemented from ost::Date. bool ost::Datetime::operator! () const Reimplemented from ost::Date. int ost::Datetime::operator!= (const Datetime &) Datetime& ost::Datetime::operator+= (const Datetime &datetime) Datetime& ost::Datetime::operator+= (const Time &time) Datetime& ost::Datetime::operator-= (const Datetime &datetime) Datetime& ost::Datetime::operator-= (const Time &time) int ost::Datetime::operator< (const Datetime &) int ost::Datetime::operator<= (const Datetime &) Datetime& ost::Datetime::operator= (const Datetimedatetime) int ost::Datetime::operator== (const Datetime &) int ost::Datetime::operator> (const Datetime &) int ost::Datetime::operator>= (const Datetime &) String ost::Datetime::strftime (const char *format) const Author Generated automatically by Doxygen for GNU CommonC++ from the source code. GNU CommonC++ Sat Jun 23 2012 ost::Datetime(3)
All times are GMT -4. The time now is 02:41 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy