1

gcc / g++ throws exit code 1 and does nothing

I tried to compile my c++ / c files using gcc / g++ !

It did nothing

  • the command neither produced a.exe file
  • it didn't throw any error ,(print anything to console)

gcc myprogram.c

it showed no error message and moved to next line with Exit code 1. The .exe file was also not created

the same thing happend for g++ So , I tried to manually run the command

same thing happened. (no output, no error)

while running in command prompt it gave the following message in popup

"The application was unable to start correctly (Oxc00000be). Click 0K to close the application."

ps:

im using windows 11, mingw-64 compiler downloaded from github "x86_64-13.1.0-release-posix-seh-msvcrt-rt_v11-rev1.7z" ,I have windows defender on my pc , I tried to turn off real-time scanning and ran the command . It didn't work. neither it didn't show any log of blocking exe files, or gcc.exe, g++.exe

i had been using the same compiler for a few months, it didn't cause any trouble earlier, now it's not even working

i can't compile my code now.


16
  • 1
    executable files not being created still very much sounds like an antivirus problem. Commented Sep 28, 2023 at 11:45
  • What is your compilation command and its full output? (As text, not a picture) Commented Sep 28, 2023 at 11:48
  • 3
    Please, don't post images of code and errors. meta.stackoverflow.com/questions/285551/… Commented Sep 28, 2023 at 11:48
  • I disabled real-time protection , and also added my working folder to exclusions in defender.. Do i have to try something else? Commented Sep 28, 2023 at 11:48
  • 1
    It seems that this command window doesn't show the whole output. Can you run your compilation commands in a plain terminal window? Commented Sep 28, 2023 at 11:55

2 Answers 2

1

Finally got it right

You just have to move the path of mingw/bin folder in environment variables up

goto environment variables .. set the path of bin folder .. now move it all the way up.

This worked for me 👍🏻

Sign up to request clarification or add additional context in comments.

Comments

-1

I had the same error but only when using Git Bash. Compiling with CMD worked fine.
For me, the solution was to move the correct compiler path upwards in the "Paths" list which you get when you run this command in Bash:

echo $PATH

To fix it, create a config file for Git Bash like this:

nano ~/.bashrc

Then add the path to the compiler to $PATH. For me it was in ucrt64:

export PATH="/c/msys64/ucrt64/bin:$PATH"`

Then save and exit from nano and run this in terminal:

source ~/.bashrc

Or restart Git Bash. Now the correct compiler will be up in the list every time.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.