C++ 如何在 Windows 8 64 位操作系统中注册 .DLL 文件?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19232004/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-27 22:37:57  来源:igfitidea点击:

How to register .DLL files in Windows 8 64-bit OS?

c++windowsvisual-studioopengldll

提问by Umair

I searched everywhere but found no result on how to register a .DLLfile in Windows 8 64-bit. See my thiswuestion too where I tried everything and then someone said that I have to register .DLL files. But how?

我到处搜索,但没有找到有关如何在Windows 8 64-bit 中注册.DLL文件的结果。也请参阅我的 这个wuestion,在那里我尝试了所有方法,然后有人说我必须注册 .DLL 文件。但是如何?

回答by Hans Passant

Only COM servers can be registered, glut32.dll is not a COM server.

只能注册COM服务器,glut32.dll不是COM服务器。

A standard mistake is copying a 32-bit DLL into c:\windows\system32. They need to be copied to c:\windows\syswow64 instead, the home for 32-bit executables on a 64-bit version of Windws. In general certainly best to avoid, messing with the Windows directories is always a mistake. Copy the DLL into the same folder as your EXE instead. Best done by a post-build event in your project.

一个标准错误是将 32 位 DLL 复制到 c:\windows\system32。它们需要复制到 c:\windows\syswow64,这是 64 位版本的 Windws 上 32 位可执行文件的主目录。一般来说,最好避免,弄乱 Windows 目录总是一个错误。将 DLL 复制到与您的 EXE 相同的文件夹中。最好通过项目中的构建后事件来完成。

回答by Gilco

Make it simple, add via Windows Desktop GUI:

简单点,通过 Windows 桌面 GUI 添加:

1) Go to "Control Panel" -> "System" -> "Advanced System Setting".

1) 进入“控制面板”->“系统”->“高级系统设置”。

2) At the "Advanced" TAB press on the lower right the button -> "Environment Variable".

2) 在“高级”选项卡上,按右下角的按钮 ->“环境变量”。

3) Add any path you want to "Path" variable, make sure to put at the end ";".

3) 在“Path”变量中添加任何你想要的路径,确保在末尾加上“;”。

4) re-start you computer.

4)重新启动你的电脑。

Done :-)

完毕 :-)

From the cmd line, you can view the "Path" values by typing:

在 cmd 行中,您可以通过键入以下内容查看“路径”值:

echo %PATH%

回声%路径%

回答by Raj Kapoor

On Windows 8.1 Pro:

在 Windows 8.1 专业版上:

  1. Copy xxx.dllfile into the c:\windows\System32folder
  2. Right-click on "Command Prompt" and select "Run as Administrator"
  3. Then register the file: regsvr32 c:\windows\system32\xxx.dll
  1. xxx.dll文件复制到c:\windows\System32文件夹中
  2. 右键单击“命令提示符”并选择“以管理员身份运行”
  3. 然后注册文件: regsvr32 c:\windows\system32\xxx.dll