Author |
Message
|
balaraju |
Posted: Thu Apr 13, 2017 4:33 am Post subject: c++ compile issue ImqStr |
|
|
Apprentice
Joined: 06 Feb 2017 Posts: 29
|
We have written custom c++ code to browse messages from queue. When we try to compile our code on Red hat Linux with gcc/g++ compiler, it is throwing the below error. Please help
error: ambiguous overload for 'operator+=' (operand types are 'ImqStr' and 'MQLONG {aka int}')
candidates are:
In file included from /opt/mqm/inc/imqobj.hpp:27:0,
from /opt/mqm/inc/imqmgr.hpp:26,
from /opt/mqm/inc/imqair.hpp:28,
from /opt/mqm/inc/imqi.hpp:26,
command run : /usr/bin/g++ -fsigned-char -o outfile br.cpp -I/opt/mqm/inc -L/opt/mqm/lib64 -Wl,-rpath=/opt/mqm/lib64 -Wl,-rpath=/usr/lib64 -limqs23gl -limqb23gl -lmqm |
|
Back to top |
|
 |
mqjeff |
Posted: Thu Apr 13, 2017 4:54 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
It seems you are trying to add things together and the compiler can't decide which class has a "++" operator to use. _________________ chmod -R ugo-wx / |
|
Back to top |
|
 |
balaraju |
Posted: Thu Apr 13, 2017 5:14 am Post subject: |
|
|
Apprentice
Joined: 06 Feb 2017 Posts: 29
|
some more logs
note: candidates are:
In file included from /opt/mqm/inc/imqobj.hpp:27:0,
from /opt/mqm/inc/imqmgr.hpp:26,
from /opt/mqm/inc/imqair.hpp:28,
from /opt/mqm/inc/imqi.hpp:26,
from br.cpp:112:
/opt/mqm/inc/imqstr.hpp:62:8: note: void ImqStr::operator+=(const ImqStr&)
void operator += ( const ImqString & );
^
/opt/mqm/inc/imqstr.hpp:63:8: note: void ImqStr::operator+=(char)
void operator += ( const char );
^
/opt/mqm/inc/imqstr.hpp:64:8: note: void ImqStr::operator+=(const char*) <near match>
void operator += ( const char * );
^
/opt/mqm/inc/imqstr.hpp:64:8: note: no known conversion for argument 1 from 'MQLONG {aka int}' to 'const char*'
/opt/mqm/inc/imqstr.hpp:65:8: note: void ImqStr::operator+=(double)
void operator += ( const double );
^
/opt/mqm/inc/imqstr.hpp:66:8: note: void ImqStr::operator+=(long int)
void operator += ( const long );
^ |
|
Back to top |
|
 |
mqjeff |
Posted: Thu Apr 13, 2017 5:21 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
What, exactly, are you trying to add together?
The error
Quote: |
/opt/mqm/inc/imqstr.hpp:64:8: note: no known conversion for argument 1 from 'MQLONG {aka int}' to 'const char*' |
seems clear... _________________ chmod -R ugo-wx / |
|
Back to top |
|
 |
balaraju |
Posted: Thu Apr 13, 2017 5:27 am Post subject: |
|
|
Apprentice
Joined: 06 Feb 2017 Posts: 29
|
the syntax is similar to amqsbcg/c.
Our executable name object(queue name) queue manager name and couple of options to browse with message id or show them in ascii mode etc... This code was written years ago for Unix (xlc++). Now we have been trying to make it work with Linux (gcc/g++) |
|
Back to top |
|
 |
mqjeff |
Posted: Thu Apr 13, 2017 5:51 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
amqsbcg is not a C++ program.
amqsbcg0.c doesn't include anything named ImqString.
I believe the MQ C++ class libraries are at least 'stabilized' if not actually out of support. _________________ chmod -R ugo-wx / |
|
Back to top |
|
 |
balaraju |
Posted: Thu Apr 13, 2017 6:17 am Post subject: |
|
|
Apprentice
Joined: 06 Feb 2017 Posts: 29
|
the ImqString is defined in imqstr.hpp and we are referring this in our headers... |
|
Back to top |
|
 |
Vitor |
Posted: Thu Apr 13, 2017 6:26 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
balaraju wrote: |
the ImqString is defined in imqstr.hpp and we are referring this in our headers... |
Which versions are in play here? What version of the MQ client libs, which version of Red Hat, which compiler version (I'm disinclined to assume it's the one that comes with the distro at this point).
Also, if the requirement is so simple (and probably pointless), why not re-write it to reflect more modern code thinking? Or replace it with one of the many free and paid utilities that can do this, and probably offer many more features you may be able to exploit?
<plug><Iowe>MQGem for example</Iowe></plug> _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
mqjeff |
Posted: Thu Apr 13, 2017 6:28 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
balaraju wrote: |
the ImqString is defined in imqstr.hpp and we are referring this in our headers... |
I'm sure that's true.
What data suggests that this is related to the issue?
The issue you have shows in problem trying to use "++" between two objjects, that the compiler doesn't know how to add. _________________ chmod -R ugo-wx / |
|
Back to top |
|
 |
balaraju |
Posted: Thu Apr 13, 2017 6:32 am Post subject: |
|
|
Apprentice
Joined: 06 Feb 2017 Posts: 29
|
Hi Vitor,
The version of mq is 9, Red hat is 7 and g++ is 4.
We already have this working in Unix, we want to leverage the same for Linux without major changes and trying any workarounds... |
|
Back to top |
|
 |
bruce2359 |
Posted: Thu Apr 13, 2017 6:37 am Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9469 Location: US: west coast, almost. Otherwise, enroute.
|
What's different? Which UNIX is it working in? Which compiler? Which MQ? _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
 |
balaraju |
Posted: Thu Apr 13, 2017 6:41 am Post subject: |
|
|
Apprentice
Joined: 06 Feb 2017 Posts: 29
|
|
Back to top |
|
 |
mqjeff |
Posted: Thu Apr 13, 2017 6:42 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
|
Back to top |
|
 |
balaraju |
Posted: Thu Apr 13, 2017 6:48 am Post subject: |
|
|
Apprentice
Joined: 06 Feb 2017 Posts: 29
|
Thanks Jeff.. we tried these options but no luck May be issue with compiler and code compatibility... |
|
Back to top |
|
 |
Vitor |
Posted: Thu Apr 13, 2017 6:58 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
balaraju wrote: |
the ImqString is defined in imqstr.hpp and we are referring this in our headers... |
I notice here that the documentation somewhat contradicts this:
Quote: |
There is a single C++ header file, imqi.hpp, which covers all of these classes |
Are you specifically importing and referencing imqstr.hpp? I doubt that's going to help and I can envisage a scenario where it would cause this problem. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
|