Visual Studio debugger and referenced libraries
Допустим, в своем проекте MyProgram Вы используете некую библиотеку MyLibrary. Как обычно, подключаете
MyLibrary.h, MyLibrary.lib. Все компилируется отлично, а вот при попытке
запуска...
---------------------------
MyProgram.exe - Unable To Locate Component
---------------------------
This application has failed to start because MyLibrary.dll was not found. Re-installing the application may fix this problem.
---------------------------
OK
---------------------------
Если вы столкнулись с этой ошибкой - читайте дальше.
Сообщение об ошибке говорит, что MyLibrary.dll was not found
. Windows ищет dll в следующих местах:
- The directory where the executable module for the current process is located.
- The current directory.
- The Windows system directory. The GetSystemDirectory function retrieves the path of this directory.
- The Windows directory. The GetWindowsDirectory function retrieves the path of this directory.
- The directories listed in the PATH environment variable.
Вероятно, ни в одном из вышеперечисленных источников MyLibrary.dll не была найдена. Соответственно, для решения проблемы следует положить MyLibrary.dll в одно из этих мест. Пункты 3 и 4 отшибаем сразу, а остальные случаи разберем подробнее.
- The directory where the executable module for the current process is located.
Наверное, это папка bin/Debug проекта, где линкер создает MyProgram.exe. MyLibrary.dll туда можно скопировать путем создания Post Build Event. Мне эта идея не нравится.
- The current directory.
Можно попросить отладчик менять стартовый каталог запускаемого приложения. Для этого есть настройка проекта Debugging->Working Directory. Мне эта идея тоже не нравится.
- The directories listed in the PATH environment variable.
Можно изменить пользовательскую (или системную) переменную PATH (System Properties->Advanced->Environmental Variables->User variables for %USERNAME%), добавив туда каталог с MyLibrary.dll.
Но мне больше всего нравится следующий трюк:
2 коммент.:
I like it when folks get together and share ideas. Great website, continue the
good work!
Check out my web page ; GFI Norte
When it comes to finding the best orthopaedics doctors in Hyderabad, choosing a clinic that offers both advanced treatments and personalized care is essential. One such trusted destination is Healio RegenX, known for its expertise in treating bone, joint, and musculoskeletal conditions.
Отправить комментарий