Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Codeblocks compile and run works but clicking on exe doesn't

Tags:

c

codeblocks

I am new to C programming. I downloaded Code::Blocks to try. I had already installed the gcc compiler and so that's what codeblocks is set to use. I wrote a simple program and compile and ran it. It ran fine when I ran it from inside Code::Blocks but when I tried to double click the .exe it said

"The program can't start because libgcc_s_dw2-1.dll is missing from your
computer. Try reinstalling the program to fix this problem."

Why is it that it works when I run it in Code::Blocks but not when I click on the file?

BTW, here are my #includes.

#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
like image 327
AdamMasters Avatar asked Oct 16 '25 18:10

AdamMasters


1 Answers

I think author already solved his problem, but I just want to add my solution. To use your executable file you need to follow these steps, to configure your project:

  1. Project -> Build Options
  2. Select correct target or project in left hand panel
  3. Tab: Linker Settings
  4. Box: Other linker settings
  5. Enter follow linker options one per line:

    -static

    -static-libgcc

    -static-libstdc++

Also,it could be helpful to add (..\mingw\bin) path to the project search directories.

like image 168
IluxaKuk Avatar answered Oct 18 '25 12:10

IluxaKuk



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!