c++ - Can't output through std::cout from static library -


i'm linking static library has std::cout wrapper works if use application code, non of library's internal outputs (used in same fashion) show output.

maybe it's not important, i'm using qt creator , qmake project files build. have added console application's config (and tried static library, had no effect).

what going wrong , how can fix this? thanks!

update: well, wrapper adapted version of this one:

the std::cout wrapper won't able 'reach in' library implicitly. have thought redirecting cout altogether? likesrc:

int main() {      std::streambuf* cout_sbuf = std::cout.rdbuf(); // save original sbuf      std::ofstream   fout("cout.txt");      std::cout.rdbuf(fout.rdbuf()); // redirect 'cout' 'fout'      // ...      std::cout.rdbuf(cout_sbuf); // restore original stream buffer  } 

that way you'd have control on data fed std::cout, regardless of library doing output (unless, of course, redirect std::cout themselves.)


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -