所以我在一个对象的方法中,但cout语句完全没有输出。cout不会产生输出
#include <iostream>
#include <stdio.h>
Object::Method()
{
printf("why is the next line not printing? This one prints fine\n");
std::cout << "This line should print second, but doesnt" << std::endl;
printf("but this line prints fine like the first!\n");
}
输出为:
为什么下一行不打印?这一个打印罚款
但这行打印好像第一!
我似乎无法弄清楚为什么它不会打印。 std::flush
也没有效果。
这段代码没有错。请尝试拿出一个SSCCE(http://sscce.org/)。 – NPE 2013-03-23 15:57:26
可能'std :: cout'已被重定向到控制台输出以外的另一个输出源。我无法真正想到任何其他解释。 – 2013-03-23 15:57:28
您正在使用哪个IDE?因为我认为它与此有关... – Saqlain 2013-03-23 16:34:56