User forums > Using Code::Blocks

EXE fails to run on another PC

(1/1)

neo1691:
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

TomCatFort:
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.

neo1691:

--- Quote from: TomCatFort 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.

--- End quote ---
fixed the broken image in the OP.
I can gives the dll file to my friend but i want to fix it permanently.

TomCatFort:
1) Distribute that dll with the exe.
2) Some sources say, that you need to add the -static flag to the linker options.

Alpha:

--- Quote from: TomCatFort on December 23, 2011, 10:11:54 pm ---2) Some sources say, that you need to add the -static flag to the linker options.

--- End quote ---
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).

Navigation

[0] Message Index

Go to full version