【问题标题】:Create an installer for my game(.exe)为我的游戏创建安装程序 (.exe)
【发布时间】:2013-07-03 21:40:53
【问题描述】:

我用 Glut C++ 构建了一个保龄球游戏,并拥有我的 .exe 文件。

现在我想为这个游戏创建一个安装程序。

我想这样做:-

当我的安装程序运行时,glut32.dll 被粘贴到 system32 文件夹中,我的游戏的 .exe 文件在桌面或任何地方。

我该怎么做。我猜 Iexpress 将无法做到这一点。

注意:- glut32.dll 必须在 system32 文件夹中才能运行此游戏。

【问题讨论】:

  • 您想要一个自解压的安装程序还是一个完整的 msi 安装?这完全取决于您要显示多少用户界面以及您希望自定义哪些参数。
  • @AmitApollo 我只是想要一种将 glut32.dll 文件粘贴到 system32 中并将 .exe 文件粘贴到任何地方的方法。
  • 编写资源的 xcopy 脚本,然后执行 regsvr32 glut32.dll。您可以使用 bat 文件命令 shell 来执行此操作。
  • @AmitApollo 我现在正在使用 NSIS。你能告诉我如何在 setOutPath 之后指定我想要的目录吗?
  • @Derek 我已经改变了它。感谢您的时间和帮助。

标签: c++ windows windows-installer exe


【解决方案1】:

错了。 glut32.dll 不一定必须在 system32 中。它只需要在.exe 文件旁边。 (或系统中的某处PATH)。

您应该能够创建一个安装程序,该安装程序将使用您的 IDE 中的 InstallShield 或类似向导解压缩您的文件。

【讨论】:

  • system32 也是 dll 的有效位置
  • 并非如此。出于 DLL 地狱的原因,Microsoft 徽标指南反对它。
  • @Kevin 我没说不是。这与我的说法并不矛盾。
  • “它必须在 .exe 文件旁边。(或系统路径中的某个位置)”意味着这些是唯一可能的位置。并且@ChristopherPainter 不管微软的指导方针是否反对它,它仍然是一个有效的位置。
  • @Kevin system32 在路径中
【解决方案2】:

我会研究NSIS(Nullsoft Scriptable Install System)

从查看简单教程开始:http://nsis.sourceforge.net/Simple_tutorials

他们将向您展示如何简单地将一些文件复制到用户的计算机上。像这样的:

# define the name of the installer
outfile "game_installer.exe"

# define the directory to install to
installDir $DESKTOP

# default section
section install

# define the output path for this file
setOutPath C:\Windows\System32

# define what to install and place it in the output path
File glut32.dll

# define the output path for this file
setOutPath $INSTDIR 

# define what to install and place it in the output path
File bowling_game.exe

sectionEnd

注意:Bartek Banachewicz 和其他人是正确的。您真的不应该将非系统 .dll 放在包含所有重要系统 .dll 的目录中。世界不会因此而终结,但这不是最佳实践。也许您可以与 NSIS 合作开发一个安装程序来满足您的需求。然后我会建议您将 OpenGL/GLUT 库/头文件安装在更合适的位置。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-10-11
    • 1970-01-01
    • 1970-01-01
    • 2018-05-18
    • 1970-01-01
    相关资源
    最近更新 更多