my programs request for some dll files when i run them on other machines
i do not want to copy the dlls in program directory. i searched and found out that by static linking the libraries i can integrate them to my executable file.
but no where on the internet i could find how to do that.
can anyone please tell me how can i statically link a lilbrary?
i know nothing about compiling in command line and compiler flags etc. i always press the build-and-run button in my IDE and everything gets done.
What library are you linking to? (what DLLs are it asking for?)
If it's just the standard VC runtime lib (msvcr90.dll or something similar to that), then you can change your project settings to link to the runtime statically.
1) From within visual studio, right click on your project, go to properties.
2) From the list on the left, go in "Configuration Properties", then "C/C++", then "Code Generation"
3) Change the "runtime library" option from "Multithreaded DLL" to "Multithreaded". (or "Multithreaded Debug" if this is a debug build -- though the release setting is more important.
If it's some other lib, then you have to get/build a static version of the lib and link to that instead of the dynamic version. To explain further I'd need to know which lib you're using.
OH, please for the sake of GOD
it is two days i am searching whole the internet and asking in forums and no one is going to answer my question. NOWHERE ON THE NET (if you don't beleive me try it. i dare you) i could find a peice of instruction on what the heck is static linking. all they say is "if you want to eliminate the need of dlls use static linking, but it makes the file size bigger." i don't know if static linking is an innate behavior like swallowing that everyone knows how to do or i am such an stupid person.
i'm not a computer student or a professional programmer, and have no access to a teacher or an informed person. just interested in programming and trying to write a junk program that is not useful for anyone on the earth.
so if there is anyone who could mind showing me some source of a little bit of explanation on linking or a tiny example about how do people statically link their libraries, i would be so very very thankful.
by the way, i'm using wxwidgets with code::blocks (not vc++) and it wants one of the wxwidgets libraries. the libraries are built by the installer during wxwidgets installation. i do not need to change a dll to a static library. the libraries are already there (e.g wxmsw28ud.a).
every one says "you should statically link your libraries". and i have no idea what that is.
i'm so sorry for my tone but i'm really felling desperate.
Anway if the dll names look anything like what Disch suggested, you may be screwed because
you will need the professional version or above of Visual Studio to do static linking.
have already read that. as i said it does not say how should i link some library to some program. it just says how cool is static linking.
anyway
i don't give a *** any more. i think my destiniy is to copy DLLs to the program directory and suck all the time.
thank you for your responses
no one can help me
bye
i know i'm late to this convo, but static linking means you would have the libraries on your own machine which follow the path to that library. Basically you would have to have all the src for that library when statically linking. static link would link at compile time and takes the code from that library and puts it into your code. it makes larger exe's, but the advantage is that it would make the exe standalone.
if you want to share a library between multiple programs then you would use a shared object library. this library would link at runtime and makes small exe's.