Author Topic: EXE fails to run on another PC  (Read 4688 times)

Offline neo1691

  • Multiple posting newcomer
  • *
  • Posts: 68
EXE fails to run on another PC
« on: December 23, 2011, 08:13:28 pm »
Hi.
I have compiled a very simple program and the executable file runs well on my PC.
I had sent the exe to my friend and it gave this error
 

Can somebody please explain me the exact steps on how to fix this issue by adding WHAT path WHERE?
I am very confused and i am new to C::B. I am just a beginner and am compiling program from books, not real time programming..and before C::B i was using turbo C++.

So i am very much new to this linker, paths, global variables and all!! :P
But i am loving C::B!!! 8) ;D
« Last Edit: December 23, 2011, 10:01:24 pm by neo1691 »

Offline TomCatFort

  • Single posting newcomer
  • *
  • Posts: 5
Re: EXE fails to run on another PC
« Reply #1 on: December 23, 2011, 08:56:41 pm »
The link of the image is broken.

Also the other PC might lack the needed runtime or some other dll. Runtimes needs to be installed and other dll files need to be distributed with your exe.
EDIT: And don't use global variables, use dependency injection.

Offline neo1691

  • Multiple posting newcomer
  • *
  • Posts: 68
Re: EXE fails to run on another PC
« Reply #2 on: December 23, 2011, 10:03:45 pm »
The link of the image is broken.

Also the other PC might lack the needed runtime or some other dll. Runtimes needs to be installed and other dll files need to be distributed with your exe.
EDIT: And don't use global variables, use dependency injection.
fixed the broken image in the OP.
I can gives the dll file to my friend but i want to fix it permanently.

Offline TomCatFort

  • Single posting newcomer
  • *
  • Posts: 5
Re: EXE fails to run on another PC
« Reply #3 on: December 23, 2011, 10:11:54 pm »
1) Distribute that dll with the exe.
2) Some sources say, that you need to add the -static flag to the linker options.

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: EXE fails to run on another PC
« Reply #4 on: December 23, 2011, 10:35:44 pm »
2) Some sources say, that you need to add the -static flag to the linker options.
This seems like a pretty reliable source: GCC online docs - Link Options.

If you happen to use the flag -mthreads anywhere, you will want to remove it (Building a standalone exe).