添加对本机 Visual C++ 项目的引用 [英] adding reference to native visual c++ project

查看:34
本文介绍了添加对本机 Visual C++ 项目的引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的解决方案中有两个 Visual C++ 项目.第一个(我们称之为 Main)是本机代码.第二个(测试),添加了 Main 作为参考.测试包含对 Main 中方法的单元测试.

I have two visual c++ projects in my solution. First one (lets call it Main) is native code. The second one (Test), has Main added as reference. Test contains unit tests to methods in Main.

当我添加 Main 作为 Test 的引用并尝试编译它时 - 我收到无法找到库的错误.添加项目作为参考,是否将Main的输出目标路径添加到Test的库目录中?

When I add Main as a reference to Test and try to compile it - I get errors that the library could not be found. Does adding a project as reference , does not add the output target path of Main to the library directories of Test ?

推荐答案

我不知道 VC 到底在做什么,但是添加对项目的引用似乎没有像 C# 那样链接库的效果.

I don't know what VC is exactly doing under the hood, but adding reference to a project doesn't seem to have effect of linking libraries unlike C#.

您可以通过c++的常用方法包含和链接来使用其他项目中的代码.

You can use the code from another project by including and linking via the usual method of c++.

这篇关于添加对本机 Visual C++ 项目的引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆