ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum IndexIBM MQ Installation/Configuration Supportc++ compile issue ImqStr

Post new topicReply to topic Goto page 1, 2  Next
c++ compile issue ImqStr View previous topic :: View next topic
Author Message
balaraju
PostPosted: Thu Apr 13, 2017 4:33 am Post subject: c++ compile issue ImqStr Reply with quote

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
View user's profile Send private message
mqjeff
PostPosted: Thu Apr 13, 2017 4:54 am Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17182

It seems you are trying to add things together and the compiler can't decide which class has a "++" operator to use.
_________________
Read, Think, Try, Repeat
Back to top
View user's profile Send private message
balaraju
PostPosted: Thu Apr 13, 2017 5:14 am Post subject: Reply with quote

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
View user's profile Send private message
mqjeff
PostPosted: Thu Apr 13, 2017 5:21 am Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17182

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...
_________________
Read, Think, Try, Repeat
Back to top
View user's profile Send private message
balaraju
PostPosted: Thu Apr 13, 2017 5:27 am Post subject: Reply with quote

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
View user's profile Send private message
mqjeff
PostPosted: Thu Apr 13, 2017 5:51 am Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17182

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.
_________________
Read, Think, Try, Repeat
Back to top
View user's profile Send private message
balaraju
PostPosted: Thu Apr 13, 2017 6:17 am Post subject: Reply with quote

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
View user's profile Send private message
Vitor
PostPosted: Thu Apr 13, 2017 6:26 am Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 24297
Location: Ohio, 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
View user's profile Send private message
mqjeff
PostPosted: Thu Apr 13, 2017 6:28 am Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17182

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.
_________________
Read, Think, Try, Repeat
Back to top
View user's profile Send private message
balaraju
PostPosted: Thu Apr 13, 2017 6:32 am Post subject: Reply with quote

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
View user's profile Send private message
bruce2359
PostPosted: Thu Apr 13, 2017 6:37 am Post subject: Reply with quote

Poobah

Joined: 05 Jan 2008
Posts: 7761
Location: US: west coast, almost. Otherwise, enroute.

What's different? Which UNIX is it working in? Which compiler? Which MQ?
_________________
I didn't know that Schrdinger had a cat.
Back to top
View user's profile Send private message
balaraju
PostPosted: Thu Apr 13, 2017 6:41 am Post subject: Reply with quote

Apprentice

Joined: 06 Feb 2017
Posts: 29

aix6,mq9,xlc
Back to top
View user's profile Send private message
mqjeff
PostPosted: Thu Apr 13, 2017 6:42 am Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17182

https://www.ibm.com/support/knowledgecenter/en/SSFKSJ_9.0.0/com.ibm.mq.dev.doc/q030470_.htm
_________________
Read, Think, Try, Repeat
Back to top
View user's profile Send private message
balaraju
PostPosted: Thu Apr 13, 2017 6:48 am Post subject: Reply with quote

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
View user's profile Send private message
Vitor
PostPosted: Thu Apr 13, 2017 6:58 am Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 24297
Location: Ohio, 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
View user's profile Send private message
Display posts from previous:
Post new topicReply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum IndexIBM MQ Installation/Configuration Supportc++ compile issue ImqStr
Jump to:



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP


Theme by Dustin Baccetti
Powered by phpBB 2001, 2002 phpBB Group

Copyright MQSeries.net. All rights reserved.