Ok, I have 5 c++ files:
PegRTU.cpp, PegIOHandler.cpp, PegIOHandler.h, pegio.c, pegio.h (PegRTU.cpp contains my main() method).
I compile them with the following commands using gcc and g++:
gcc -c pegio.c -o pegio.o
g++ -c PegIOHandler.cpp -o PegIOHandler.o -std=c++0x
g++ -c PegRTU.cpp -o PegRTU.o -std=c++0x
g++ -o pegrtu *.o -lopendnp3
My main method has an infinite do-while loop for monitoring the system and sending readings to a server. It contains a cout call outside (before) the loop to print to terminal. My problem is:
Cout does not print to the terminal when I run my program. Why?
I made a test program:
#include <iostream>
int main()
{
std::cout << "TEST";
while(1)
{
}
return 0;
}
And I found this to not work either, it only prints if I remove the infinite loop. My program's functionality works fine, it monitors and sends up readings, but it does not want to print to the terminal. I also first had the concern it may have to do with the multistage compiling, but I think it's probably the loop? Any advice?
Thanks!
Cornel