Question

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?

Was it helpful?

Solution

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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top