从哪里开始部署 C++ 代码? [英] Where do one start on deploying C++ code?
问题描述
我只想将我制作的一些琐碎的 SDL 应用程序发送给我的非编码人员朋友.我用谷歌搜索了一下,但我得到的只是更多的困惑.我真的不知道我应该做什么以及从哪里开始.
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.
有些人说我需要使用 Make/Cmake 之类的东西,有些人说使用某种安装程序,如 NSIS 或 INNO Setup,有些人说我只需要将所有库放在我将发送给最终用户的文件夹中.
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.
我在新的 Windows VM 上尝试了最后一个,它要求我不知道它们是什么的奇怪 dll( libstdc++-6 & libgcc_s_seh-1 ).我安装了它们并放置了文件夹,但它一直要求更多.
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.
我不知道我应该做什么.我是否需要使用其他程序,如 CMake 或 NSIS?(我正在 Eclipse 上构建项目作为 C++ Managed Built ).如果没有,我应该使用什么样的构建选项?我应该在文件中添加哪些库?我想要的只是一个起点和一个我可以遵循的指南.
我在应用中使用的库:
stdio.h
math.h
time.h
string
SDL.h ( SDL2 )
SDL_image.h
(是的,我在文件中提供了 SDL dll,并设法在 VM 上运行了一个空白窗口应用程序.但是actaul 应用程序不起作用.)
( 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.
推荐答案
有人说我需要使用 Make/Cmake 之类的东西
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.
某种安装程序,如 NSIS 或 INNO Setup
some sort of installer like NSIS or INNO Setup
您可以使用它们,但这与向您的朋友发送存档中的 .exe
+ .dll
并没有根本区别.
You can use those, but it's not fundamentally different from sending your friends an .exe
+ .dll
s in an archive.
我在新的 Windows VM 上尝试了最后一个,它要求我不知道它们是什么的奇怪 dll ( libstdc++-6 & libgcc_s_seh-1 )
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 )
您似乎在使用 MinGW.这些 .dll
随您的编译器一起提供,并且与 g++.exe
位于同一目录中.
You seem to use MinGW. Those .dll
s are shipped with your compiler, and are in the same directory as g++.exe
.
它们应该被复制到你的 .exe
所在的文件夹中.
They should be copied to the folder where your .exe
is.
它一直要求更多
它应该只要求编译器附带的一些.dll
,或你使用的库的.dll
(SDL2.dll
).
It should only ask for some of the .dll
s shipped with the compiler, or for .dll
s of the libraries you use (SDL2.dll
).
正如评论中提到的,复制.dll
s 的另一种方法是静态链接,即将库直接嵌入.exe
.
As mentioned in the comments, an alternative to copying the .dll
s is static linking, i.e. embedding libraries directly into the .exe
.
这篇关于从哪里开始部署 C++ 代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!