Daqs
Daqs

Reputation: 964

std::cout not showing on screen

This is a fairly simple problem I can't get my head around. It was working before and suddenly now that I'm using std::cout, in the Visual Studio 2013 output window I do not see the output, but I see a bunch of background executions happening. I feel I have messed up something. This is App Game Kit project using C++.

Here's the simple code to output:

#include "template.h"
#include <iostream>

using namespace AGK;

app App;

void app::Begin(void)
{
    agk::SetVirtualResolution (1024, 768);
    agk::SetClearColor( 151,170,204 ); 
    agk::SetSyncRate(60,0);
    agk::SetScissor(0,0,0,0);
    std::cout << "Hello";    // SIMPLE PRINT
}

void app::Loop (void)
{
    agk::Print( agk::ScreenFPS() );
    agk::Sync();
    // std::cout << "Hello";    // TRIED HERE TOO (works like update() in Unity3D)
}

This is what my debug window is showing, instead of printing "Hello":

enter image description here

FYI, the program is working perfectly without any errors. Am I looking at the wrong window? where can find my output?

Upvotes: 0

Views: 1605

Answers (2)

Harley
Harley

Reputation: 562

Try using this before you return from the method: log.flush(); log.close();

Upvotes: 0

timmy_stapler
timmy_stapler

Reputation: 587

for logging, i write my entries to a file. here is the Contents of my log method in cpp:

void MyFileUtils::log(string msg)
{
ofstream log("logfile.txt", ios_base::app | ios_base::out);
log << msg << endl;
return;
}

i then just call this whenever i want to log something. i have it as a singleton. Then i just look in my media subfolder to see the contents of logfile.txt

Upvotes: 1

Related Questions