Visual Studio 2010库链接顺序 [英] Visual Studio 2010 library linking order

查看:296
本文介绍了Visual Studio 2010库链接顺序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在Visual Studio 2010中指定库文件应该链接的顺序?

How do you specify, in Visual Studio 2010, the order in which library files should be linked?

我有一个项目链接到libexpat和另一个库。这个库(不在我的控制下)似乎还包括libexpat。问题是,我们使用不同版本的库(XML_UNICODE vs not)。在Visual Studio 2008的东西似乎工作好了(可能是巧合),但在Visual Studio 2010中,错误的libexpat实例被链接。我想,如果我可以指定这两个库应该链接的顺序,那么我可以绕过这个问题。

I have a project that links against libexpat and against another library. This library (not under my control) seems to also include libexpat. The problem is that 'we' use a different version of the library (XML_UNICODE vs not). In Visual Studio 2008 things seemed to work out okay (might have been a coincidence), but in Visual Studio 2010 the wrong instance of libexpat is linked. I was thinking that if I could specify the order in which these two libraries should be linked that then I could circumvent the problem.

推荐答案

我找到了一个'解决方案:如果你通过 #pragma注释(lib ... 添加库链接的顺序是相同的,当我通过项目文件添加库而不是通过pragma语句添加库时,我仍然保持这个问题的解决方案。

I have found 'a' solution: if you add the libraries through #pragma comment(lib... the order of linking is the same as the order in which you type those pragma's. I'm still keeping the question open for a solution when the libraries are added through the project file instead of through pragma statements.

这篇关于Visual Studio 2010库链接顺序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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