Where do one start on deploying C++ code?

生来就可爱ヽ(ⅴ<●) 提交于 2021-01-29 21:59:56

问题


I just want to send some trivial SDL apps that I made to my non-coder friends. I googled a bit but all I get is more confusion. I genuinely don't know what I should do and where to start.

Some said I would need to use Make/Cmake kind of stuff, some said use some sort of installer like NSIS or INNO Setup, some said I just need to put all the libraries in the folder that I would send to end user.

I tried the last one on a fresh Windows VM, It asked for weird dlls that I don't know what they are ( libstdc++-6 & libgcc_s_seh-1 ). I installed them and put the folder anyway but then it kept asking for more.

I don't know what I should do. Do I need to use another program like CMake or NSIS? ( I am building project on Eclipse as C++ Managed Built ). If not, what kind of build options that I should use? Which libraries that I should add in the file? All I want is a starting point and a guide that I can follow.

Libraries that I use in the app:

stdio.h
math.h
time.h
string
SDL.h ( SDL2 )
SDL_image.h

( And yes, I provided SDL dlls in the file and managed to get a blank window app running on VM. But actaul app does not work. )

Any information regarding to the title is appreciated. Thanks beforehand.


回答1:


Some said I would need to use Make/Cmake kind of stuff

Those wouldn't change anything. The build systems just give you a convenient way to invoke the compiler.

some sort of installer like NSIS or INNO Setup

You can use those, but it's not fundamentally different from sending your friends an .exe + .dlls in an archive.

I tried the last one on a fresh Windows VM, It asked for weird dlls that I don't know what they are ( libstdc++-6 & libgcc_s_seh-1 )

You seem to use MinGW. Those .dlls are shipped with your compiler, and are in the same directory as g++.exe.

They should be copied to the folder where your .exe is.

it kept asking for more

It should only ask for some of the .dlls shipped with the compiler, or for .dlls of the libraries you use (SDL2.dll).


As mentioned in the comments, an alternative to copying the .dlls is static linking, i.e. embedding libraries directly into the .exe.



来源:https://stackoverflow.com/questions/61016744/where-do-one-start-on-deploying-c-code

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!