当前位置: 动力学知识库 > 问答 > 编程问答 >

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

问题描述:

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.

网友答案:

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.
网友答案:

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

分享给朋友:
您可能感兴趣的文章:
随机阅读: