0

I am following the book ACE Programmer's Guide, The: Practical Design Patterns for Network and Systems Programming By Stephen D. Huston, James CE Johnson, Umar Syyid. In this book in the very beginning there is a listing:

#include "ace/Log_Msg.h"

void foo (void);

int ACE_TMAIN (int, ACE_TCHAR *[])
{
    ACE_TRACE(ACE_TEXT ("main"));

    ACE_DEBUG ((LM_INFO, ACE_TEXT ("%IHi Mom\n")));
    foo();
    ACE_DEBUG ((LM_INFO, ACE_TEXT ("%IGoodnight\n")));

    return 0;
}

void foo (void)
{
    ACE_TRACE (ACE_TEXT ("foo"));

    ACE_DEBUG ((LM_INFO, ACE_TEXT ("%IHowdy Pardner\n")));
}

As the book says, this code should have output:

(1024) calling main in file `Simple1.cpp' on line 7
   Hi Mom
   (1024) calling foo in file `Simple1.cpp' on line 18
      Howdy Pardner
   (1024) leaving foo
   Goodnight
(1024) leaving main

But it's outputting:

Hi Mom
Howdy Pardner
Goodnight

I'm running it in Windows 7, Visual C++ 2010, as a Win32 console application. Is there any other way to learn ACE easily? It seems tedious to learn in this way. Qt has its own cross-platform networking library. Does ACE has any advantage over Qt's library?

1 Answers1

4

That's because you haven't defined ACE_NTRACE, and so ACE_TRACE expands to nothing by default. Add this to your code:

#define ACE_NTRACE 0
Eitan T
  • 32,660
  • 14
  • 72
  • 109
  • I don't have 15 reputations, that's why I can't upvote it :(. Can you suggest me any good resource to learn ACE? – Isfar Ahmad Sifat Jul 14 '12 at 14:18
  • This [online ACE tutorial](http://www.huihoo.org/ace_tao/ACE-5.2+TAO-1.2/ACE_wrappers/docs/tutorials/online-tutorials.html) can help you get started... – Eitan T Jul 14 '12 at 14:20
  • I think this tutorial is outdated. When I try to compile the first program it shows errors. For instance, when I compile the program of this page [link](http://www.huihoo.org/ace_tao/ACE-5.2+TAO-1.2/ACE_wrappers/docs/tutorials/001/page02.html), I get error like: fatal error C1083: Cannot open include file: 'acceptor.h': No such file or directory. When I change the 'acceptor.h' with 'ace/Acceptor.h', a bunch of errors occur. Can you please help me. – Isfar Ahmad Sifat Jul 15 '12 at 06:33
  • 1
    Sorry, I didn't notice it. It's not ACE header, rather a custom header. Thanks once again for you assistance. – Isfar Ahmad Sifat Jul 15 '12 at 07:13