c - Creating .exe that needs no DLLs or Libraries -
i have project requires use of pthreads. on own computer, have pthread-win32 setup, , can compile project follows, , have work fine.
gcc -o3 engine.c -o engine.exe -lpthread
the problem is, want able send .exe else not have gcc, , not have pthreads. tried sending computer of mine, , unable run it, throwing error message lpthreads not being installed.
any appreciated, thanks
this may generate gigantic .exe
, anyway, use static linking...
gcc -o3 engine.c -o engine.exe -wl,-bstatic -lpthread
note: strange -wl,-bstatic
necessary and correctly typed (it's argument linker).
you need specify -wl,-bstatic
before -lmystaticlibrary
may specify library want statically-linked. if want other libraries dynamically-linked, pass -wl,-bdynamic
after static libraries.
docs (long , boring) here.
Comments
Post a Comment