c++ program execution in cmd malbehaviour [duplicate] - c++

This question already has an answer here:
Running my C++ code gives me a blank console
(1 answer)
Closed 4 years ago.
Using cmd commands
- g++ hello.cpp -o hello.exe
- hello
compiles hello.cpp and runs the hello.exe program.
Normally, it used to just print 'helloworld' in the cmd window, which takes no time.
However, yesterday it started to behave differently in that after compilation, when the program is first run, another window pops out very briefly (showing 'helloworld', I can see it clearly even though the window vanishes very soon) before 'helloworld' is printed in cmd window (which is seconds later, very slow and annoying!)
The extra window does not pop out for subsequent execution. It only pops out and causes delays during the first run.
//----------------------------------------------------------------
I have completely no idea how to make it behave like it used to, and here are my guesses of what caused it:
I watched porn in goolge chrome incognito window but in developer mode (had to add sci-hub extension in developer mode) and perhaps I got some virus that affected the path somehow. What's more for this guess: my google chrome is starting to crash more frequently than prior to watching porn in developer mode.
Compiler auto-update? But I haven't manually updated the compiler recently. It didn't ask for update too.
Windows update?
Anyone has any idea pls? This is very annoying bcos as quite a beginner in c++ I frequently run tests and have to go through the time delays that I have never experienced (except for programs that need longer time to execute like inefficiently-coded sudoku solver). Of course I can do it with online c++ compiler but I find notepad++ more pleasing than any other mediums.

I made the program run in a crazy 10000000000 for-loop so that I could take a closer look on the popout window.
Found out that it was Avast Cybercapture (cleary written up there) scanning for zero attacks.
Disabled scanning for that directory.
Resolved. Huuray!

Related

Visual code c++, machine terminal not showing and disappearing

I have problems with the terminal not outputting anything when I run my code, I provided some pictures for guidance. I'm not new to c++ but this is my first time setting up VS code. This is the ; latest version of VS Code. My goal is to have something where I can arbitrarily make code in c++ for practice, and maybe more languages down the road.
Whenever I set "stopAtEntry" to true, the machine terminal will sometimes output, but it's not consistent. And after closing the machine terminal it takes about 17 seconds for it to close. (my computer is new, so is this just a VS code thing?)
When "stopAtEntry" is false, the terminal immediately closes when the program starts.
I'm not sure if I need to adjust this file or even make it. The guy in the tutorial edited it. But it didn't help or worsen the problem. So I might remove it like it was before.
The VS code terminal works fine. It's just the machine terminal that's not working as intended. Oris just simply how compilers work. The only other ones I've tried were Bloodsheed c++ and Net Beans (for Java).
Thank you.

Was GDB listing the code as I stepped through, or was I only dreaming?

Years ago, when I last had call to use GDB to debug a Linux server, I seem to remember seeing a listing of the code that was being executed. Perhaps it was just the current line +/- five lines or so. I think i also remember it redrawing the entire console, every time I executed a command, so that the code listing was always at the top of the screen.
Now that I am once again in need of GDB's assistance, is my memory playing cruel tricks on me? Or does such a mode actually exist?
The documentation I'm finding online just points me at the 'l' command to list code. That looks like it has some potential, but there doesn't seem to be a way to get it to dynamically update as I step/next my way through the code.
If it's significant, I'm running Ubuntu on a dedicated Linux machine, and (since the program uses OpenGL) the actual debugging is going on inside a Weston Compositor terminal window.

Execute Command not working in Geany (Windows 10)

I am really new to programming (actually trying to get this to work for my 1000 level intro C++ class) so I apologize for bad descriptions and lack of terminology.
I am having trouble getting a "Hello World" program to work on Geany. I have followed the instructions here http://wiki.geany.org/howtos/win32/getting-started , pretty much to the letter. My program gets a successful message when I hit compile/build. When I hit execute the terminal pops up but it is blank.
There is a flashing cursor in the spot where I would expect Hello World to be but instead it is blank, and I cannot type anything in the window. From what I've researched I think it may be a similar problem from here How do you make Execute do anything in Geany? but searches on changing the terminal form to work for windows has not yielded any results.
In fact, I have not found much help for Geany on windows at all, so if there is a better set of software to use that is pretty basic I would be interested, I am only really attached to Geany because that is what we will be using in class (on a Linux operating system)
Thanks for the help!
John
Avast Antivirus does, in fact, cause Geany to fail execution of the program. Windows 10 Pro 64-bit using Geany 1.26 full installer with MinGW. I just shut down shields for 10 mins and this allowed the program to execute.
Thanks.

C++ / Unkillable process / Can't debug

I've created a small parser that generates an internal representation of an expression from a string. It does compile correctly, but i just can't debug it. When i try to run it, whether it's in debug mode or not, the console pops-up and immediatly closes. In my process list, the program still appears, using 0% cpu and 100 Ko memory, and there is just no way to kill it except by restarting my PC.
The first time i tred using code blocks with the mingw compiler, and the second time i tried using visual studio 2012, but in both case i got the same problem. When trying to run it with VS it showed an error message saying something like "abort has been called".
I can provide the source code if really needed. I'm not using anything extraordinary in it, just pure standard C++ language and iosream to display results and errors in a console.
What can this be due ?
Thanks for your help :)

Program hangs in Xcode debugger, but not in Instruments

I'm working on debugging a game written in C++ and it recently started hanging on the splash screen when I try to run it in Xcode (in Debug mode). I can't identify any changes in my code that could have caused this, and there aren't any log messages being printed while this hang is happening (something that I know can severely slow down a program). I then opened Instruments and used the time profiler to try and find the source of the problem, but when I ran my program on the time profiler it progressed past the part where it hangs, and ran as expected. Both running and profiling are set to use Debug mode so the build is the same, does anyone know what could possibly cause an issue like this?
More info: I'm using LLVM/Clang as the compiler and LLDB as the debugger. Looking at Activity Monitor during the hang I can see the game is shown as 'not responding' and Xcode is using a lot of CPU activity, despite not printing any log messages etc.. In 'Edit Schemes' the Profile scheme is set to use the Run action's arguments and environment variables.