Simplest way to write output message to 'output window' in Visual Studio 2010?

后端 未结 6 1666
难免孤独
难免孤独 2020-12-30 01:32

I\'ve tried OutputDebugString function and most of the time I get error like :

error C2664: \'OutputDebugStringA\' : cannot convert parameter 1          


        
6条回答
  •  北海茫月
    2020-12-30 01:49

    The most common way I'm aware of is the TRACE macro:

    http://msdn.microsoft.com/en-us/library/4wyz8787%28VS.80%29.aspx

    For example:

    int x = 1;
    int y = 16;
    float z = 32.0;
    TRACE( "This is a TRACE statement\n" );
    
    TRACE( "The value of x is %d\n", x );
    
    TRACE( "x = %d and y = %d\n", x, y );
    
    TRACE( "x = %d and y = %x and z = %f\n", x, y, z );
    

提交回复
热议问题