0

这可能是一个非常愚蠢的问题,但我找不到指定 dll 文件路径的方法。我已经将搜索目录设置为相对于项目的根目录,它在代码块中运行良好。

问题是当我双击exe文件时找不到库。我试图设置相对于 exe 文件的路径,但仍然找不到文件。

4

1 回答 1

0

Before code::blocks runs/debugs your program, it sets up all the required paths for your app to run. These are defined in your *.cbp file.
If you want to "double click" your exe and expect it to find your dlls, you should do one of the following:-

  1. Have your needed dlls in your exe's CWD.
  2. Have your needed dlls in one of your search path env. vars.
  3. Open a console and -> 'set PATH="X:\Path\to your dll's\dir";%PATH% && myapp.exe'
  4. Make use of a manifest file

You will want to make use of option #1 and maybe #4 if you decide to deploy your app on other machines
HERE IS A USEFULL MSDN ARTICLE ON THE TOPIC

于 2013-05-30T15:33:41.430 回答