Running application in Visual Studio Express - visual-studio

I am coming from XCode and this is probably a stupid question, but after I build my program successfully, I try to click on the Application in the debug folder and the window just closes. How do I run my application that I create?

The above answers are correct, but if your question is simply why your command prompt closes immediately upon your program's termination, you have two options:
Put a breakpoint on your main()'s } before you run.
Use Ctrl+F5, which will add a "Press any key to continue" at the end so you can see all of your program's output, but it will launch the application without attaching the debugger.

You can compile and run the program by pressing F5.
However, if you're talking about non-gui console application which just prints something and exists,
the output window will close right away. If this is the case, you might want to open command prompt (cmd.exe) and run it from there manually, or insert some "wait for keypress" handling, such as getchar().
Otherwise, there might be something wrong with your program :)

Debug --> Run
or
press F5

Related

golang: optional console on windows

I am writing a service program which is expected to run in background. On Windows it will open a console window when run. I want it to go to background directly without that console window, so I used the -ldconf "-H=windowsgui" option, which worked as expected.
However, there is a catch. The program has a command line option -help, which output command line usage in the console. If I use -H=windowsgui, the help text is NOT printed even I start it in cmd.exe prompt.
It seems that the windowsgui option is not what I want. Is there anyway that the -help still works at commant line, and the console window will not persist if the program runs normally. I do not care if there is a console window pops up, provided that it disappears shortly without user intervention. i.e. I want a way on windows which is similar to the & operator on Linux.
P.S. if provided solution uses any other tools, I want that tool to be a Windows component, not any 3rd-party program. Thanks.

I have a debugging issue with Visual Studio Community 2015

Whenever I am debugging a new program by pressing the "Start without deubgging" button, sometimes it will open up a blank program like this:
I can not close these blank programs at all no matter how many times I try and close it, even with the task manager. And if I try to debug it again, it just opens up another blank program. The only way to fix this program is to either restart or shut my computer, but doing that tedious and I don't want to do that every time this happens. Is there a way to prevent this or at least close the blank programs? Thanks!

Xamarin Studio fails to execute code with login shell in Mac Terminal

I'm new to Xamarin on the Mac, and I'm running into some issues running my code. I don't think it should matter, but I'm using the D language plugin to develop my code.
When Terminal is set to Shells open with: Default login shell (which is zsh in my case, but bash results in the same issue), hitting the execute button causes Xamarin Studio to pop up a Terminal window which closes before it can do anything, and then Xamarin Studio reports Cannot execute "blah". ScriptError. I added an infinite loop at the beginning of my program to make sure the shell isn't exiting because the program terminated quickly, and sure enough the program seems not to be starting at all.
If I instead tell Terminal Shells open with: Command (complete path): /opt/local/bin/zsh, the terminal happily opens up and the window is named correctly as "Xamarin Studio External Console" but of course nothing is executed except for the shell itself.
Any way to debug or fix this would be greatly appreciated!
MonoDevelop/XamarinStudio uses xterm by default. Dunno if that piece of info might help.

Command prompt gets stuck and continues on enter key press

Does anyone come across a scenario when the command prompt is running a process and then it gets stuck and the process is also sleeping.
Then when we press Enter key in the cmd window the process continues.
Is there any way to avoid this?
or can this be handled??
The other answers are wrong! The Windows console has a separate mode called "mark mode" for selecting text. In that mode the screen will be frozen, texts will go into the buffer and if the buffer is full the running process will be blocked
If quick edit mode is enabled (by default it's disabled in older Windows but enabled in Windows 10) then clicking inside the console window will activate mark mode and result in what you observed
It's very easy to accidentally click the console and stop the command. When you press Enter or Esc the selected text will be copied to clipboard and mark mode will be exited, therefore the process will run again. Priority is absolutely irrelevant here because if the buffer is full then the process is blocked forever until you exit mark mode, regardless of the priority. The console does nothing to change the priority when there are some inputs. Try opening an app that outputs a lot of data in the highest priority and click the console, the app will still be blocked indefinitely even if the CPU is in idle
Here's an example of QuickEdit mode setting in Windows 8 console:
To fix this you can disable QuickEdit mode if you don't need it. In this case copying will be more troublesome because you must open the context menu, select Edit > Mark. You can also disable QuickEdit mode by setting ENABLE_QUICK_EDIT_MODE with SetConsoleMode() if you're writing your own console application
See also
How and why does QuickEdit mode in Command Prompt freeze applications?
What does it do exactly if I click in the window of cmd?
Turn off Windows 10 console "Mark" mode from my application
If other processes are sucking all the cycles and have a higher prio, then your process might be stopped. A user input might just give it a prio boost, so it starts again. See Microsoft Docs at https://learn.microsoft.com/en-us/windows/win32/procthread/priority-boosts for more information.
It happened to me today while executing a batch file that includes TFSBuild.
I already received email notification from TFSBuild that it is successful, but somehow the batch file did not proceed to the next line.
I waited 1 hour.
I pressed Enter, Mark for Edit etc. but none of that worked.
Then I hit Ctrl+C to try to terminate the batch file.
When asked if I want to terminate, i entered N.
Weirdly enough, the batch file continued after that.

My Ruby files don't run correctly

When i click on a .rb file to run it a CMD window pops up for a brief second and then closes again. This is probably a really nooby question thats easily fixed but i've looked everywhere for help. But like i said it pops up for a brief second and i THINK while its up its executing the code but when the codes done it closes so i don't know if i'm making mistakes in code or other important things like that.
Run the program through the command prompt (CMD), that way you can see the result, otherwise the window closes when the program exits.
Alternatively, you can prevent the program from exiting by putting some sort of blocking instruction at the end of the script, such that the program waits for user input before exiting.
Press Windows_Key+R and then type CMD. Browse to the location of the file and then type ruby your_ruby_file.rb. The program is running, but Windows automatically closes the window upon completion of the command.
To get Windows to run your *.rb files through Ruby when you click on them in the UI, you have to associate the .rb extension with the ruby.exe executable. Such an association is called a "Windows File Association." Here's a Microsoft Knowledge Base article that'll tell you how to create such a thing.
http://support.microsoft.com/kb/307859

Resources