error c1107 could not find assembly please specify the assembly search path using /AI or by setting the LIBPATH environment variable

蓝咒 提交于 2019-12-10 18:15:32

问题


I'm making two trivial C++/CLI projects, one is an executable and the other is a DLL. In the executable, I write

#using "DllLibName.dll"

and it gives me error c1107, which I though would be easy to solve. I googled for LIBPATH and went to Linker, General, Additional Library Directories and added the folder containing DllLibName.dll and it still wouldn't work. Same error.

I tried replacing the directive with

#using "D:\AbsolutePath\DllLibName.dll"

and everything works. I don't wanna have to type in the full absolute path. What am I missing? This feels so stupid.


回答1:


Probably in your case the path must be set for the compiler, not the linker.

Properties -> C/C++ -> General -> "Resolve #using References" or see the documentation for the AI-flag




回答2:


Are the two projects in the same Solution? If so, then don't use #using, add a reference to the other project, and let Visual Studio take care of the paths.

  • Right click on the executable project, select "Properties".
  • In the properties window, select "Common Properties" at the top of the list at the left.
  • Click the "Add New Reference" button.
  • Select your DLL project from the "Projects" tab.


来源:https://stackoverflow.com/questions/14179382/error-c1107-could-not-find-assembly-please-specify-the-assembly-search-path-usin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!