PATH环境变量没有作用? (VS2010)
据我所知,此 MSDN 演练,当 DLL 与源不在同一目录中时,PATH
环境变量应指向 DLL 的位置。
我已经通过 Property Pages > 设置了这个变量配置属性> VC++目录>可执行目录
(根据工具提示,它确实对应于PATH
变量)。
然而,当我尝试编译并运行我的代码时,我仍然收到“缺少 DLL”错误。手动将 DLL 复制到源文件夹中可以解决问题,但在这种情况下这并不是一个真正的选择。
我在这里缺少什么?
From what I can tell from this MSDN walkthrough, the PATH
environment variable should point to the location of a DLL when the DLL isn't in the same directory as the source.
I have set this variable through Property Pages > Configuration Properties > VC++ Directories > Executable Directories
(which does correspond to the PATH
variable, according to the tooltip).
When I try to compile and run my code, however, I still get "missing DLL" errors. Manually copying the DLL into the source folder solves the problem, but that's not really an option in this case.
What am I missing here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
“可执行目录”页面所指的 PATH 目录是在编译代码时搜索的目录,而不是在运行时搜索以执行程序的目录。
如果您不想每次在命令提示符中设置路径,则可以更新用户会话的 PATH 环境变量。 (我的电脑 -> 属性 -> 高级 -> 环境变量)然后您可以更新系统 PATH 变量或为您的用户帐户创建本地 PATH 变量。 (执行此操作后,请确保重新启动命令提示符)
The PATH directory that the "Executable Directories" page refers to are the directories that are searched for compiling your code, not the directories that are searched at run time to execute your program.
If you don't want to set your path every time in your command prompt, you can update your PATH environment variable for your user session. (My Computer -> Properties -> Advanced -> Environment Variables) You can then either update your system PATH variable or create a local PATH variable for your user account. (Make sure you restart your command prompt after you do this)