[英]Link problem between projects in same solution (Exe depends on Lib)
I have one solution with several projects.我有几个项目的一个解决方案。 Say
ProjectA
is the one that will produce the exe file, and ProjectB
simply produces a .lib
file.假设
ProjectA
将生成 exe 文件,而ProjectB
只生成一个.lib
文件。 I have checked that ProjectA
depends on ProjectB
, so that ProjectB
will always compile before ProjectA
.我已经检查过
ProjectA
依赖于ProjectB
,因此ProjectB
将始终在ProjectA
之前编译。
When I compile ProjectB
everything goes fine.当我编译
ProjectB
时,一切正常。 But if I compile ProjectA
I get linking errors saying that some method of B does not exist.但是,如果我编译
ProjectA
,我会收到链接错误,指出 B 的某些方法不存在。 I have checked, and it does exist.我查过了,确实存在。
¿What is going on?到底是怎么回事?
Thanks for your help!谢谢你的帮助!
项目属性,链接器,常规:将“链接库依赖项”设置为“是”。
I found there were several things I needed to check to fix the vexing link error:我发现我需要检查几件事情来修复令人烦恼的链接错误:
"link.exe" exited with code 1104.
“link.exe”以代码 1104 退出。
Project -> Linker -> General -> Link Library Dependencies: Yes
Project -> Linker -> General -> Link Library Dependencies: Yes
Project Depdendencies
and ensure Project A
references Project B
Project Depdendencies
并确保Project A
引用Project B
ProjectA
ensure that you don't have an additional linker library dependency on ProjectB.lib
.ProjectA
上确保您没有对ProjectB.lib
的额外 linker 库依赖。 This seems to encourage to look VS to look for another library called ProjectB.lib
, elsewhere.ProjectB.lib
的库。$(SolutionDir)$(Platform)\$(Configuration)\
).$(SolutionDir)$(Platform)\$(Configuration)\
)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.