Cannot cout or printf to console

Hi,

Often I ouput to the (xcode) console to debug my app, but currently cout, printf, etc. do not seem to work. Only at the beginning of testApp:setup(), I can output to the console. Later, in testApp:setup(), update() and draw(), nothing appears in the console.
What am I doing wrong?

Thanks in advance,

Ben

I know this sounds silly, but are you sure you’re in debug mode, sure your app is continuing to execute, it’s not looping endlessly, there’s no strange messages from the compiler? You might want to set a breakpoint and step through the code that way to see what’s happening.

My app is running ok. That is, it’s responsive to key and mouse events.
I’ve found out that as soon as I setup a sound stream, I can’t print stuff the the console anymore.

  
  
  
void testApp::setup() {	  
	  
	printf("Setup()..\n"); // does output to the console  
	  
	// setup audio stream  
	ofSoundStreamSetup(1, 1, this, 44100, 256, 4);  
  
	printf("Setup()..\n"); // does NOT output to the console  
  
	...  
  
}  
  
  

About the usage of breakpoints: I’m not familiar with breakpoints; they yield a lot of info I don’t understand.

Does someone know what’s happening?

/ Ben

I think you are going to want to try rebuilding the application… (useful to always do if you ever see voodoo) go to build->clean then build again.

besides that, can you try to post up the whole thing? I am trying on 0.06 and it seem to works fine for printf / cout.

take care!
zach

I’ve cleaned the build and recompiled the app, but that doesn’t change a thing. (I’m also trying on 0.06.)
The snippet of code I provided earlier is actually all I need to run into the voodoo, but here is an entire testApp.cpp:

  
  
#include "testApp.h"  
  
//--------------------------------------------------------------  
void testApp::setup(){  
	  
	cout << "Hello, ";	// does appear in console  
	  
	ofSoundStreamSetup(1, 1, this);  
	  
	cout << "World!" << endl;  // does NOT appear in console  
	  
	y = 0;  
	  
	ofBackground(0, 0, 0);  
	ofSetColor(255, 255, 255);  
	  
}  
  
//--------------------------------------------------------------  
void testApp::update(){  
	  
	cout << "Update..." << endl;  // does NOT appear in console  
  
}  
  
//--------------------------------------------------------------  
void testApp::draw(){  
	  
	y = (y + 1) % ofGetHeight();  
	  
	ofLine(0, y, ofGetWidth(), y);  
  
}  
  
//--------------------------------------------------------------  
void testApp::keyPressed(int key){  
  
}  
  
//--------------------------------------------------------------  
void testApp::keyReleased(int key){  
  
}  
  
//--------------------------------------------------------------  
void testApp::mouseMoved(int x, int y ){  
  
}  
  
//--------------------------------------------------------------  
void testApp::mouseDragged(int x, int y, int button){  
  
}  
  
//--------------------------------------------------------------  
void testApp::mousePressed(int x, int y, int button){  
  
}  
  
//--------------------------------------------------------------  
void testApp::mouseReleased(int x, int y, int button){  
  
}  
  
//--------------------------------------------------------------  
void testApp::windowResized(int w, int h){  
  
}  
  
  

Added to testApp.h

  
  
  
int y;  
  
  

Hmm, I can’t replicate that at all, they all print for me. You confirmed that you can run the audio samples that come with the of download? Maybe somehow the rtAudio lib got corrupted?

Thanks for taking a look at it.
Except for the output problem (after calling ofSoundStreamSetup()), everything works a-ok. (The audio examples work and my own audio stuff, which I did not include in the code above works as well.) So, there’s not really a problem, I just have to solve/debug some c++ problems/misunderstandings in seperate test apps now…

Somewhat, the stdout/stderr is being changed after the setup. This way, when we call std::cout, they print the messages in other place (probably in a NULL place :shock:

frangossauro, thank you very much!
fprintf(stderr, “Message”) works a charm!