I currently have 2 virtual machines running, one is a server and one is a client. They are both running Ubuntu. I created a C++ program to connect to a MYSQL server. When i open up a terminal in the server VM, the c++ program compiles and runs PERFECTLY!
BUT, when I try to run it on the client, it wont work at all. The code compiles perfectly fine but when i type “./main” to start the program, NOTHING comes up. It’s just a blank screen. I totally do not get why this is happening. The code is exactly the same on both the client and the server, but for some reason, it wont display ANY of my code when I run it on the client side. Below are pictures to show what i mean
Here is a link to view a screenshot of what I am talking about (https://i.stack.imgur.com/JG3QM.jpg). In the first picture, I compile the program, which compiles fine. I then run the program but NOTHING outputs to the screen.
The second picture shows the program being ran on the server and shows what is suppose to be output on the screen after the initial ./main command
What should I do to find out what’s going wrong?
Either add logging to your program or run it under
straceto figure out where it’s getting stuck or what it’s waiting for.At the most basic level, you add logging by adding log statements. Say your code looks like this:
Temporarily change it to:
Then see what messages you get. If you don’t get “about to do a” then it’s a constructor for a global object or process initialization that’s hanging. If you get “about to do a” but not “about to do b”, then it’s
a()that’s hanging. And so on.