I'm programming in C++ with Netbeans 8.2 at school, these computers have Ubuntu 14.04 and gcc-4.3
.
The cout randomly works altought it doesn't send any errors in the log.
Every computer here has the same problem.
main.cpp:
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char** argv) {
cout << "Hello World!" << endl;
return 0;
}
Posible (and expected) output:
Hello World!
RUN FINISHED; exit value 0,; real time: 0ms; user: 0ms; system: 0ms
Other posible output:
RUN FINISHED; exit value 0,; real time: 0ms; user: 0ms; system: 0ms
Sometimes the compiler prints out and finish without being noticed. So you can use cin to check if that is happening to you.
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char** argv) {
cout << "Hello World!" << endl;
int test;
cin >> test;
return 0;
}
Here the compiler will wait for you to enter a value, so you will have plenty of time to see your output.
我解决了这个问题,转到Project Properties -> Run -> Console Type -> Standard output
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.