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 Index » IBM MQ API Support » Configuring Eclipse to work with MQ C++

Post new topic  Reply to topic
 Configuring Eclipse to work with MQ C++ « View previous topic :: View next topic » 
Author Message
Boomn4x4
PostPosted: Fri Dec 02, 2011 5:37 am    Post subject: Configuring Eclipse to work with MQ C++ Reply with quote

Disciple

Joined: 28 Nov 2011
Posts: 172

I'm trying to run the C++ sample program from the IBM application Programming Reference
http://publib.boulder.ibm.com/infocenter/wmqv6/v6r0/index.jsp?topic=%2Fcom.ibm.mq.csqzal.doc%2Ffg10120_.htm

I imported the source code into eclipse, however, all of the functions in the imiq.hpp include aren't being recognized. I have included the /opt/mqm/include directory, and eclipse doesn't seem to have a problem seeing the include, but its throwing "Undefined reference" errors for the imqi objects.

For example:

Declaration of:
ImqQueueManager manager ;

Throws:
undefined reference to `ImqMgr::ImqMgr()' cppTest.cpp /TestC++ line 15 C/C++ Problem
Back to top
View user's profile Send private message
Vitor
PostPosted: Fri Dec 02, 2011 5:51 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

Have you applied the advice given in this near-duplicate thread?
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Boomn4x4
PostPosted: Fri Dec 02, 2011 6:48 am    Post subject: Reply with quote

Disciple

Joined: 28 Nov 2011
Posts: 172

Would I be asking again if that advice had worked?
Back to top
View user's profile Send private message
Vitor
PostPosted: Fri Dec 02, 2011 6:51 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

Boomn4x4 wrote:
Would I be asking again if that advice had worked?


If the advice hadn't worked, I'd have expected you to post that fact on the original thread rather than opening a new one where there's a sporting chance someone will just suggest the same thing again. That would seem to make more sense.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Fri Dec 02, 2011 6:56 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Can you be explicit about the exact steps that you've done, at the eclipse workspace and project level?

And then likewise explicit about what "does not work".
Back to top
View user's profile Send private message
Boomn4x4
PostPosted: Fri Dec 02, 2011 7:01 am    Post subject: Reply with quote

Disciple

Joined: 28 Nov 2011
Posts: 172

Are you planning on helping, or are you just going to play internet police?

If I wanted someone to point out insignificant flaws in the way I approach things, I'd have called my wife and ask her for help... She's a marketing manager for a greeting card company, and would have gotten me just as close to a solution with my problem as you have. Though, at least with her, after that pissing match was over, I'd at least have a pretty good shot at make up sex with her... I doubt things will end as well with this discussion.
Back to top
View user's profile Send private message
Vitor
PostPosted: Fri Dec 02, 2011 7:04 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

Boomn4x4 wrote:
Are you planning on helping, or are you just going to play internet police?


I don't know enough about C++ under Eclipse to add much value.

And I'm not playing at being a moderator on this forum.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Boomn4x4
PostPosted: Fri Dec 02, 2011 7:21 am    Post subject: Reply with quote

Disciple

Joined: 28 Nov 2011
Posts: 172

mqjeff wrote:
Can you be explicit about the exact steps that you've done, at the eclipse workspace and project level?

And then likewise explicit about what "does not work".


Operating System: Linux SUSE
Eclipse Version: Version: Indigo Service Release 1Build id: 20110916-0149

1. In eclipse, File > New C++ Project
A. Project name TestC++
B. Use default location /home/mxb931/workspace
C. Finish

2. In eclipse project explorer
A. Right click on the project folder
B. Select Properties
C. C/C++ Genearl > Paths and Symbols
D. Includes > C++ > Add "/opt/mqm/inc"
E. Libraries Tab > Add > /opt/mqm/lib/libmqm.so

EDIT: I just did Step 2.E (which I hadn't been doing before) and it now resolves the objects, including the shared object library fixed this. However, now, when I build the project, I still have two errors:

1. Description Resource Path Location Type
cannot find -l/opt/mqm/lib/libmqm.so TestC++ C/C++ Problem

2. Description Resource Path Location Type
make: *** [TestC++] Error 1 TestC++ C/C++ Problem
Back to top
View user's profile Send private message
mqjeff
PostPosted: Fri Dec 02, 2011 7:26 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

You're referencing a link in the v6.0 information center..

Are you working with MQ v6? V7.0? 7.1?

Particularly with 7.1, there's some things you need to do differently.
Back to top
View user's profile Send private message
Boomn4x4
PostPosted: Fri Dec 02, 2011 7:49 am    Post subject: Reply with quote

Disciple

Joined: 28 Nov 2011
Posts: 172

I'm working with MQ 7.0

This "cannot find" library doesn't make any sense to me. I used the eclipse explorer to browse to the library to include it... I have no idea why it can't be found.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Fri Dec 02, 2011 8:00 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

It's not your toolkit that can't find it, it's make. The eclipse explorer you used was needed to register the libraries so that the Toolkit can find it.

Your make file still needs to function as if it was called in a standalone shell.

I suspect if you went to a shell prompt, and issued make, you'd see the same error.

Either edit your make file, or set C++ Build,Environment to make sure that you have put the MQ libraries on the LIBPATH or PATH or etc.
Back to top
View user's profile Send private message
Boomn4x4
PostPosted: Fri Dec 02, 2011 8:26 am    Post subject: Reply with quote

Disciple

Joined: 28 Nov 2011
Posts: 172

I've gone into C++ > Build, Environment, and appended /opt/mqm/lib to the PATH variable, but there was no change.

My PATH environment reads:
:/fiscal/dlc/bin:/fiscal/system/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/X11R6/bin:/var/lib/dosemu:/usr/games:/usr/lib/mit/bin:/usr/lib/mit/sbin:/sbin:/usr/sbin:/opt/mqm/lib

addition in bold.

No change.

I also added a new LIBPATH variable to the environment, again no change.

The output of my make is:
make all
Building target: TestC++
Invoking: Cross G++ Linker
g++ -L/opt/mqm/lib -L/opt/mqm/inc -L/usr/lib -o "TestC++" ./cppTest.o -l/opt/mqm/lib/libmqm.so
/client_root/usr/bin/../lib/gcc/i586-suse-linux/4.3/../../../../i586-suse-linux/bin/ld: cannot find -l/opt/mqm/lib/libmqm.so
collect2: ld returned 1 exit status
make: *** [TestC++] Error 1

**** Build Finished ****

I do see that the path to /opt/mqm/lib is not there... so I can understand why Eclipse is failing... but how do I fix it?
Back to top
View user's profile Send private message
Boomn4x4
PostPosted: Fri Dec 02, 2011 9:58 am    Post subject: Reply with quote

Disciple

Joined: 28 Nov 2011
Posts: 172

Going off of the IBM MQ documentation, if I compile using:
g++ -m32 -fsigned-char -o delme test.cpp -I/opt/mqm/inc
-L/opt/mqm/lib -Wl,-rpath=/opt/mqm/lib -L/opt/mqm/lib
-Wl,-rpath=/opt/mqm/lib -Wl,-rpath=/usr/lib -limqs23gl -limqb23gl -lmqm


The application compiles just fine.

I would have to assume that the -rpath parameter is telling the compiler where to find the libraries.

But how do I get eclipse to do this for me automatically? The reason I want to work in eclipse is to simplify things, if i have to manually make my own make files, this kind of defeats the purpose.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Fri Dec 02, 2011 10:01 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

I think an important difference between your manual gcc and the eclipse one is the lack of -m32.

you can add args to the make command that gets issued.
Back to top
View user's profile Send private message
Boomn4x4
PostPosted: Fri Dec 02, 2011 10:13 am    Post subject: Reply with quote

Disciple

Joined: 28 Nov 2011
Posts: 172

Well... finally figured it out, it was a combination of a few problems.

For starters, it was a big misunderstanding on my part on how the libraries and library paths work. I had my library path set as /opt/mqm/lib. I had my library set to /opt/mqm/libmqm.so

Eclipse was telling me it couldn't find libmqm.so because it was looking for the Library Path + Library.... /opt/mqm/lib/opt/mqm/lib/libmqm.so ... Ooops

Secondly, I wasn't even using the right library in the first place. Not sure, entirely of the difference, but I was specifying "libmqm.so" as the library, the correct library was libimqs23gl.so

Thirdly, Just like how the complier works... you don't need to specify "lib" and ".so". just "imqs23gl", the compiler takes care of the rest.

So the final fix was to specify:
Library Path = /opt/mq/lib
Library= imqs23gl
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ API Support » Configuring Eclipse to work with MQ C++
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.