Unable to run C programs using any compiler - c

I had to write code in C and run it for an assignment. Since this is the first time that I'm using C, I downloaded MinGW as a compiler and Code Blocks as an IDE. I had no problem compiling the code given by my professor but it never runs (this is a simulation for an M/M/1 queue). When I say it never runs, I mean that a command prompt like window pops up and nothing happens after that. Every time I close that window and try to compile the SAME program again, I get an error that says that permission to access the file has been denied.
I then deleted Code Blocks and tried running the program through command prompt but I have the same problem. I've now tried doing it using LCC-Win but nothing has changed. Another weird thing that happens when I run any program is that three instances of the .exe file of that particular program are in my processes under task manager. I then need to restart my computer to try compiling that same program.
I even tried running a simple Hello World program and I have the same problem!
I am currently using a Windows 7 32-bit system.
Any help would be greatly appreciated!

Related

I have problems running my code in an ide

I want to execute my programs in code blocks but I don't know what the problem is. When I try to run my program it says that "It seems that this file has not been built yet" , and when I press the build button it doesn't do anything !!!

gdb quits automatically after running the program

I'm trying to debug a simple program of several line with gdb from the command line.
The problem is that whenever I run the program it runs the program and then automatically assume that I wanted to quit and quit gdb for me.
I'm using gcc compiler and I've updated the version (which solved another problem that I had).
to clarify the problem is that it is not me who entered the quit command after the run command, gdb generates it automatically without asking me and then assumes yes.
I fixed this problem by running gdb in a cygwin window rather than a Windows command window. I get the cygwin window by running (i.e., double-clicking on) mintty.exe, which on my machine is at
C:\cygwin64\bin\mintty.exe

CLion not running in Terminal

There's this bug with the placement of certain characters in the embedded terminal in CLion (the Run tab that pops up when you click the Run button), and I figured out that if I changed the terminal in CLion, that wouldn't happen. I changed the terminal to cmder, and it is all working now, except one thing: I can't figure out how to make CLion run the program to that terminal.
I tried changing the configuration, but all it did on run was open cmder but not execute the program (I had to run it manually, by writing the file name).
I wonder, what's the way to fix this, and make CLion directly run C programs on the terminal, instead of the Run tab?
Thank you.
The CLion run configuration always runs in the integreted run window. That is not a terminal emulator, and it cannot be changed so that it runs in an actual terminal emulator (like cmder).
Your best bet is to try to fix the "character placement" in the run window. Maybe ask a different question where you explain the issue, or if it's a clear bug, file a bug report for it.

How to attach debugger to a C program when run using Jenkins

I have a batch script that calls a bunch of programs written in C that do a lot of data processing. It works fine when run manually but when Jenkins calls the batch, one of the programs fails with a useless error message.
Before I litter the program with printf()s, I tried to use DebugBreak() to attach the debugger to see what difference Jenkins is making but the program just ends without invoking the debugger.
Is there a way to invoke the debugger from within the failing program that'll work with Jenkins?
EDIT: I tried calling MessageBox() but nothing appears and Jenkins sits there waiting for console output.

Debugging using input file OS X

I searched for a solution to my problem already in Google and here in stack overflow.
I didn't found an understandable and precise solution for my problem:
I've written a program that maintains an inventory.
It compiled without warnings or errors and it works quite well when I type in commands by hand. When I'm running the program with an input file with much more parts I get a segmentation fault 11.
Now I want to debug my program but don't know how to do this using input files.
I already did some debugging via the CodeBlocks IDE. Didn't find a option for this.
I used malloc and realloc functions in my program and think the error happened there because I never used it before.
Could you please help me in following ways:
I need a debugger that can debug while the program runs with an input file.
The debugger must be able to check for memory leaks or things like this.
Thanks
Armin
Debugging with command line input vs. Debugging with a input file is the totally same.
You must understand this.
When you start debugging session in the IDE, it is by default 'no input' mode (no input file).
But you can specify startup conditions for the program, including working directory, command line arguments, etc.
By using these options, you can run the debugging session exactly same as user running the program with input files.

Resources