![]() |
|
[C] C++ Dependency Explanation - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [C] C++ Dependency Explanation (/showthread.php?tid=5913064) Pages: Pages
1
2
|
C++ Dependency Explanation - ApexLead - Nov 28, 2018 Hello everyone, As I know C++ is a native language which means it has no dependencies as long as it runs on a windows machine, but whenever I try to run a little code I wrote on different machines than the one I created it on I get a missing DLL error for msvcp140.dll and vcruntime140.dll. How can I assure my EXE will run on every windows machine without needing to add anything? Thanks in advance ✌ RE: C++ Dependency Explanation - TCP - Nov 28, 2018 It's because you don't embed it in the program when you generate the code, C/C++ -> Code Generation -> Runtime Library -> Multithreaded in Release version will solve your problem RE: C++ Dependency Explanation - HFDone - Nov 28, 2018 you using Visual C++ 2015 every version have differnent runtime the other os dont have Microsoft Visual C++ 2015 Redistributable installed RE: C++ Dependency Explanation - ApexLead - Nov 28, 2018 (Nov 28, 2018 08:26 AM)Exp500 Wrote: It's because you don't embed it in the program when you generate the code, C/C++ -> Code Generation -> Runtime Library -> Multithreaded in Release version will solve your problem Thanks :) Is this the only way tho? It pumped my EXE from 12kb to 209kb :/ (Nov 28, 2018 08:35 AM)HFDone Wrote: you using Visual C++ 2015 every version have differnent runtime So how can I make my executable compatible with every windows OS like tool programmers do? RE: C++ Dependency Explanation - TCP - Nov 28, 2018 (Nov 28, 2018 08:41 AM)ApexLead Wrote: Thanks :)Either you embed it or load it from an external source RE: C++ Dependency Explanation - ApexLead - Nov 28, 2018 (Nov 28, 2018 08:47 AM)Exp500 Wrote: Either you embed it or load it from an external source What do you mean by external source? Its either I embed it or go back to the old position where I need it available on the PC? RE: C++ Dependency Explanation - TCP - Nov 28, 2018 (Nov 28, 2018 08:49 AM)ApexLead Wrote: What do you mean by external source? Its either I embed it or go back to the old position where I need it available on the PC? It's a runtime module, you need to have it in the application or installed RE: C++ Dependency Explanation - ApexLead - Nov 28, 2018 (Nov 28, 2018 08:58 AM)Exp500 Wrote: It's a runtime module, you need to have it in the application or installed Got you, thanks :) RE: C++ Dependency Explanation - Vuln - Nov 28, 2018 Those are MSVC dependencies, because of Visual Studio's default configuration. But if you want to then you're free to install and use another compiler such as GCC. RE: C++ Dependency Explanation - ApexLead - Nov 29, 2018 (Nov 28, 2018 09:41 AM)Jailbyte Wrote: Those are MSVC dependencies, because of Visual Studio's default configuration. But if you want to then you're free to install and use another compiler such as GCC. So if ill use GCC the exe will remain like 12kb but without dependencies? RE: C++ Dependency Explanation - 3DES - Nov 29, 2018 (Nov 29, 2018 12:48 AM)ApexLead Wrote: So if ill use GCC the exe will remain like 12kb but without dependencies? No. GCC bloats more than msvc. Anyway, you are using too many other libraries and shit, to get small stub remove all other libraries and even CRT, use only winapi. RE: C++ Dependency Explanation - LanMan - Nov 30, 2018 Because like other people said, you are linking with the CRT: 1: you can load it dynamically (What your 12kb exe does) 2: You link it statically (Larger size exe) 3: You design your code to work without the CRT and remove it. If low size and no dependencies are important, remove the CRT RE: C++ Dependency Explanation - ApexLead - Dec 2, 2018 (Nov 29, 2018 12:31 PM)3DES Wrote: No. (Nov 30, 2018 08:24 AM)LanMan Wrote: Because like other people said, you are linking with the CRT: What do you mean by CRT? And how to I remove the urlib and other libs if they are needed for my exe to work? RE: C++ Dependency Explanation - LanMan - Dec 2, 2018 (Dec 2, 2018 03:20 AM)ApexLead Wrote: What do you mean by CRT? And how to I remove the urlib and other libs if they are needed for my exe to work? https://docs.microsoft.com/en-us/cpp/c-runtime-library/crt-library-features?view=vs-2017 They are needed if you are using runtime feature otherwise aren't, and with msvc you compile with /NODEFAULTLIB to remove it and all default library RE: C++ Dependency Explanation - 0xDEAD10CC - Dec 2, 2018 (Nov 28, 2018 08:11 AM)ApexLead Wrote: Hello everyone, Lol, you're heavily misinformed. That first sentence is nowhere near true by itself, but additionally those missing dll issues you're having means you're depending on the C++ redistributables from your project settings. A native language doesn't mean no dependencies... Nevermind how inaccurate the "as long as it runs on a windows machine" statement is. (Nov 28, 2018 08:41 AM)ApexLead Wrote: Thanks :) OS compatibility is not a guarantee, which is why some people provide different installers depending on whether you're running Win7 or Win10. The code internally uses the preprocessor so you can write platform or OS specific code for other people to compile in their own environments, otherwise runtime checks are invovled since the preprocessor will only solve these issues pre-compile time. (Nov 28, 2018 08:47 AM)Exp500 Wrote: Either you embed it or load it from an external source Or better yet, don't use it if you care about filesize. You'll have to change the entrypoint and mod a few other things in the way you write your code though because /NODEFAULTLIB means you're excluding access to use a bunch of stuff. There's also a lot of other things you can do such as merge sections of the file to get a smaller size to the point where even UPX creates a larger binary. In most cases, making sure to compile using the default RELEASE build will shrink the output enough for most. |