Reputation: 3230
I have set path to the gcc
inside the dev-c
. It compiles fine and creates the executable but it fails to run the program and shows a message box (as shown in the first picture) first and then prints the error message on the console
Dev-Cpp
on my system, but when I invoke the compiler using the command prompt I get these mentioned issues.
I know that dependancy walker
says I have dependancy issues, but if that is the case then how does Dev-CPP compile the program on my computer ? As said before Dev-Cpp
is able to compile and run the code that is written on to its editor. My best guess is that gcc detects my 32 bit operating system and adds some switch to Dev-Cpp
compiltation process like
gcc -something -something my_program.c
can some one find what that something
is ?
Upvotes: 0
Views: 11873
Reputation: 1
I had this error. I traced it back to bitdefender(antivirus) causing the problem. I removed bitdefender and its working fine. No other changes were made.
Upvotes: 0
Reputation: 321
continuing from electromorphous' answer, If you are in windows, type in your search bar "virus and threat protection" click the option with exact same name. you will see an interface like this,
Click on Open app
, your anti-virus app will pop up(in my case it is McAfee),
Click on real-time scanning
by clicking the triple dots on the left
Click the blue turn off
button (and choose when you want to resume it again) for turning off the real-time scanning, about which the above answers mentioned.
Upvotes: 1
Reputation: 11
You must turn off your Real-time scanning feature of Antivirus installed in the system because Real-time scanning continuoulsy protects your PC against Viruses,spyware and other threats by instantly checking files any time you or your PC uses them.So Anti-virus stops this file to execute as it assumes it as threat to the system but it is not so,therefore turn off the Real-time scanning feature so that you can execute it easily.
Upvotes: 0
Reputation: 77
I came across this question while looking around as I was having a similar issue.
My program looks exactly like that but my command in cmd was gcc Hello.c
in which case it creates a temporary a.exe file or gcc Hello.c -o Hello
in which case it creates a Hello.exe file. If I go ahead and try to run it, it says Access is denied. I found out it was my anti-virus with its real-time scanning. After turning off this feature it runs perfectly.
Upvotes: 2
Reputation: 340198
If you look carefully at the CPU column in the depends display, you'll see that your program has been compiled as an x64 binary. It looks like your system doesn't have a 64-bit version of Windows installed.
So apparently your gcc is configured to produce x64 binaries by default. Use the -m32
option to get it to produce a 32-bit x86 binary.
Upvotes: 2
Reputation: 1341
This error can be caused by a few different issues:
1) File is corrupt, bad, or missing 2) File is not designed for your version of windows 3) File is a virus, worm, or other malware file 4) Hardware incompatibility
I think we can probably rule out the last two, which leaves 1 and 2.
1) Corrupted file: This could happen if when you create the exe you leave out important files required to make it work. These are files that would be in your dev environment (source files, header files, etc). If they aren't exported properly, they may cause this problem. Missing file: Search your file system for a.exe. Make sure it actually exists before running it. Running it from the dev environment does not guarantee it exists on your file system.
2) File is not designed for your version of windows: This actually seems like the most likely issue. If you are writing the program to run on a 64-bit version of windows, for example, it won't run if you have a 32-bit machine. Also, if you're using the newest (or a newer) version of dev-c, it may default to creating an exe designed for windows vista, 7, or 8. I believe there are settings somewhere where you can change this, but I'm not 100% sure. I haven't used dev-c. Look through the settings/preferences/options menus and see if you can find what version it's creating the exe for. I expect if you change it to XP, it will work just fine.
Good luck!
Source: http://www.computerhope.com/issues/ch000726.htm
Upvotes: 0