Problems mixing MFC and cout/cerr/clog

Problems mixing MFC and cout/cerr/clog

Post by Neil Steine » Fri, 18 Jul 2003 04:02:24



I'm trying to implement some basic development-time sanity checks on a
multi-platform app, and for the MFC target I can't seem to get anything
out of cout, clog, or cerr.  For example:

    std::cout << "this never shows up anywhere" << std::endl;

I've verified that the proper code is getting generated, but the output
never shows up in the debug log (debugging remotely from a Mac).  If I
invoke the app from a Command Prompt under Windows, nothing shows up either.

I understand that Windows GUI apps are initialized without a console, so
I've tried calling ::AllocConsole(), but that makes no difference.  Am I
supposed to be doing something special to enable console output?

Neil

 
 
 

Problems mixing MFC and cout/cerr/clog

Post by MW Ro » Fri, 18 Jul 2003 05:44:01




Quote:>I'm trying to implement some basic development-time sanity checks on a
>multi-platform app, and for the MFC target I can't seem to get anything
>out of cout, clog, or cerr.  For example:

>    std::cout << "this never shows up anywhere" << std::endl;

>I've verified that the proper code is getting generated, but the output
>never shows up in the debug log (debugging remotely from a Mac).  If I
>invoke the app from a Command Prompt under Windows, nothing shows up either.

>I understand that Windows GUI apps are initialized without a console, so
>I've tried calling ::AllocConsole(), but that makes no difference.  Am I
>supposed to be doing something special to enable console output?

It very well may be being ran and you don't know it,  there is a
different buffering going on and this may run at the end of your program
in a flash just before it exits.    Then again it may just be going
straight to a bit bucket.

Instead of writing to  console why not either use GUI dialogs or better
still write to a file.

Ron

--
           Metrowerks has moved, our new address is now
                     7700 West Parmer Lane
                       Austin, TX 78729
        Sales and Support 512-996-5300   800-377-5416    


 
 
 

1. Problem when using cout << long-long-var

=========================================================
Tornado  : Version 2.0.2
VxWorks  : Version 5.4.2
BSP      : Version 1.1/1
Compiler : ccsimpc
           gcc version egcs-2.90.29 tornado 2.0 980515
           (egcs-1.0.3 release)
Host     : Windows2000
Target   : VxSim for Windows (VxWorks target simulator)
=========================================================
Project Type : bootable VxWorks image (custom configured)
=========================================================

I have a problem when using
 cout << long-long-var

|| ###### C++-code : BEGIN ######
// file.cpp
// Fragment

#include "iostream"

long long var;

  cout << var << endl;

|| ###### C++-code : END ########

|| ###### Compilation : BEGIN ######
// Fragment

ingw32\lib\crt1.o \
 dataSegPad.o partialImage.o ctdt.o -o vxWorks
partialImage.o: In function `_tff':
\wpwr\host\src\gnu.simpc.cpp\gcc\cp\tinfo2.cc(.text+0x1e90): undefined reference to `ostream::operator<<(long long)'
make: *** [vxWorks] Error 0x1

|| ###### Compilation : END ########

|| ###### iostream.h : BEGIN ######
// Fragment

    ostream& operator<<(long n);
    ostream& operator<<(unsigned long n);
#if defined(__GNUC__)
    __extension__ ostream& operator<<(long long n);
    __extension__ ostream& operator<<(unsigned long long n);
#endif

|| ###### iostream.h : END ########

Questions.
  1. Why does 'operator<<(long long n)'  depend on 'if defined' ?
     For instance, 'operator<<(long n)' doesn't depend on that.
  2. May/can/should/must I add __GNUC__ to the compilation option?
  3. What does __extension__ mean ?

--
====================
  Alex Vinokur
    http://up.to/alexvn
    http://go.to/alexv_math


  ====================

2. FBI Documents Show Carnivore Can 'Eat' Everything

3. Problem with creating *.clog file in MPICH 1.2.4 for FORTRAN programs.

4. Procmail pointers

5. cout ( std::basic_ostream < ... > ) symbols problems

6. Domain problem

7. Please Help - HP Scanjet 4c ands NT

8. My broken Nino the storry continues, once more.

9. Orbix: What happens to cerr on server side

10. Kinky Curly on Mixed (for mixed chicks or dudes)

11. explained variance in mixed models (was re: proc mixed)

12. Proc Mixed ODS output problem - Problem solved