I am writing a custom installer launcher in C which opens, reads and writes files. I use fopen() to open the files. This works perfectly on Linux and the binary does not depend on libstdc++.so but on Windows in Visual Studio 2010 I get a dependency on MSVCR100.DLL. If I add the /NODEFAULTLIB flag the linker fails.
I need this program to be free of the MSVCR100.DLL dependency since it launches an installer which at a later stage installs the VC++ 2010 Redistributable and at the time of the launch it is not sure if the host machine has this library.
How can I manipulate files in VS without MSVCR100.DLL?
You get the dependency to msvcr100.dll (and probably msvcp100.dll) because your project settings define this. You should use static linking instead of dynamic linking of the runtime library.
Change your C/C++ code generation settings: Runtime Library. Select an option without DLL.
Alternatively, if you can change your code a bit, you can use the Win32 API (CreateFile, ReadFile...). This will link to kernel32.dll, which is always available.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With