Solved

MSMQ Transaction problem - use of undefined type 'ITransaction' generated at compile time...

Posted on 2004-04-08
2
569 Views
Last Modified: 2007-12-19

 Greetings,

    I am trying to use an MSMQ internal transaction in a call to MQReceiveMessage and at compile time am getting the following errors:

Compiling...
MSMQStage.cpp
filename.cpp(600) : error C2027: use of undefined type 'ITransaction'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\mq.h(26) : see declaration of 'ITransaction'
filename.cpp(600) : error C2227: left of '->Release' must point to class/struct/union
Error executing cl.exe.
Creating browse info file...

The code I have (which for the most part came directly off the MSDN website's MSMQ examples page) looks as follows:

ITransaction *pTransaction;  // Pointer to transaction object


// Initiate an internal transaction.
 
hr = MQBeginTransaction(&pTransaction);


hr = MQReceiveMessage(
                          pLinkUserData->hQueue,            // Queue handle
                          pLinkUserData->receiveTimeout,   // Max time to (msec) to receive the message
                          pLinkUserData->receiveAction,   // Receive action
                          &msgprops,                   // Message property structure
                          NULL,                         // No OVERLAPPED structure
                          NULL,                        // No callback function
                          pLinkUserData->hCursor,     // No cursor handle
                          pTransaction                 // Join in a transaction
                          );


      if (FAILED(hr))
       {
          pTransaction->Release();  // <--- line 600 where the errors are being generated upon compilation.
       }

Based on the errors I am getting my suspicion is that I may have the wrong version of MQ.H although I recently went through the painful experience of downloading and installing the entire latest windows SDK kit for a related reason in which MQReceiveMessageByLookupId was not declared in the MQ.H I previously had.

My point is that I believe I have the latest version of MQ.H at this point and am still getting the errors outlined above.. has anyone seen this and know how I can get past this problem? if I am doing something wrong Please let me know, if this is yet another MQ.H versioning problem, then the joy I am having just can't be measured...! Btw, I am on Windows XP Pro running MSMQ 3.0

Thanks,

adgarcia13

PS: I have cross-posted this question in the Windows Programming topic area.
0
Comment
Question by:adgarcia13
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 500 total points
ID: 10784940
It seems that you forgot to

#include <transact.h>

before

#include <mq.h>

The header states:

//
//  Clients that need transactions should include transact.h before mq.h
//  For the clients not needing transactions - ITransaction is  opaque
//
0
 

Author Comment

by:adgarcia13
ID: 10785049

That would be correct! Thanks jkr.

adgarcia13
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question