简体   繁体   English

VS2010:在项目lib目录之一的子目录中找不到库

[英]VS2010: can't find a library when it is in a subdirectory of one of the project lib directories

I have a folder in my project directory where I put all of the libraries I'm using, this folder has subdirectories for each library, where the .lib files reside. 我在项目目录中有一个文件夹,我在其中放置了所有正在使用的库,此文件夹包含每个库的子目录,.lib文件位于其中。 I have added this folder to the project lib search folders, but it can't seem to find the library when I at the library to the project in the form of: 我已经将此文件夹添加到项目lib搜索文件夹中,但是当我以以下形式访问项目库时,似乎找不到该库:

LibSubFolder/Lib.lib; LibSubFolder / Lib.lib;

If I move the lib out into the main folder and then just include Lib.lib; 如果我将lib移到主文件夹中,然后仅包含Lib.lib; that works, or if I change the lib search folder setting to point to the actual sub folder of the lib then that also works, finding the lib in that sub folder... 起作用,或者如果我将lib搜索文件夹设置更改为指向lib的实际子文件夹,那么它也起作用,在该子文件夹中找到lib ...

So its like I just can't have sub directories in my library name when adding it to the library input in the project settings? 因此,就像将其添加到项目设置中的库输入中时,我的库名称中没有子目录一样? its very weird as I swear this has been fine in older visual studio 我发誓这很奇怪,在老式的视觉工作室中还不错

My project is just on my C drive so its not a matter of paths being too long. 我的项目就在我的C盘上,所以路径不是太长。 I am using Visual C++ 2010 with service pack 1 installed as part of Visual Studio 2010 Premium 我正在使用Visual C ++ 2010,并将Service Pack 1安装为Visual Studio 2010 Premium的一部分

Only Visual studio 2012 support LibSubFolder/Lib.lib . 仅Visual Studio 2012支持LibSubFolder/Lib.lib

A simple test: 一个简单的测试:

test.exe:test.cc
    cl /c /IE:\tmp\TestLIB\TestLIB test.cc
    link /LIBPATH:E:\ test.obj tmp\testlib.lib

Both Visual Studio 2008 and 2010 give error: Visual Studio 2008和2010都给出错误:

cannot open file tmp\\testlib.lib

PS: the testlib.lib is in the folder e:\\tmp . PS:testlib.lib在文件夹e:\\tmp

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM