VS17上的LINK1181链接库失败 [英] Linking a library fails with LINK1181 on VS17

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

问题描述

我正在尝试在我的项目中使用ADTF流媒体库.当我包含lib时,出现LNK1181错误.该库带有标头,lib文件和dll文件.

I am trying to use the ADTF streaming library in my project. When I am including the lib, I get the LNK1181 error. The library comes with the headers, the lib files and dll files.

我已经在C/C ++中添加了路径->常规->其他包含目录.

I have added the path inside the C/C++ -> General -> Additional Include Directories.

此外,我已经在链接器->输入->其他依赖项中添加了库.

In addition, I have added the library inside the Linker -> Input -> Additional Dependencies.

这也是错误屏幕截图.

更新:我已将dll和libs的位置更改为我的项目路径,然后再次包含它.现在它没有抱怨lib本身.现在我收到一个错误LNK2001.我相信这也是一个链接器错误.

Update: I have changed the location of the dll and the libs to my project path and include it again. It does not complain now about the lib itself. Now I am getting an error LNK2001. I believe it is also a linker error.

这一切都出错了!

更新2:之后,我看到了构建的完整日志.我认为这似乎表明,链接器找不到我的库.是吗?

Update 2: After I see the full log of the build. This appears, I think this means, the linker can't find my lib. Is that right?

主要应用代码如下:

#include "pch.h"
#include <iostream>
#include "adtf_streaming.h"
using namespace adtfstreaming;

int main()
{
    std::cout << "Hello World!\n"; 
    IADTFFileReader *pFileReader = IADTFFileReader::Create();

}

而试图读取/导入我的库的头文件是

and the header file which is trying to read/ import my lib is

#ifndef _ADTF_STREAMING_LIBRARY_DLL_ 
#define _ADTF_STREAMING_LIBRARY_DLL_

#ifdef WIN32
    #ifdef STREAMINGLIB_EXPORTS
        #pragma message ("Create ADTF Streaming Library ")
        // export symbols
        #define DOEXPORT __declspec( dllexport )
    #else
        #pragma message ("Use dynamic ADTF Streaming Library ")
        #ifdef _DEBUG
            #pragma comment( lib, "adtfstreamingD_290.lib" )
        #else
            #pragma comment( lib, "adtfstreaming_290.lib" )
        #endif

        #define DOEXPORT __declspec( dllimport )
    #endif
#else
    #ifdef STREAMINGLIB_EXPORTS
        #define DOEXPORT __attribute__ ((visibility("default")))
    #else
        #pragma comment( lib, "adtfstreaming_290.lib" )
        #define DOEXPORT __declspec( dllimport )
    #endif
#endif

//standard includes 
#include <stdlib.h>
#include <string.h>

//adtf base types and errors
#include "adtf_base_ref.h"

//streaming lib version
#include "adtf_streaming_version.h"

//adtf streaming lib package headers
#include "adtf_streaming_pkg.h"

#endif //_ADTF_STREAMING_LIBRARY_DLL_

推荐答案

我找到了问题的答案.好吧,问题综合起来.

I found the answer to the problem. Well, a combination of problems.

该库仅支持0x86计算机.我再次构建它来支持0x64,并且它可以正常工作.

The library was built to support 0x86 machines only. I have built it again to support 0x64 and it worked.

P.S.它也可以在Visual Studio 2017上运行,不幸的是文档很差并且缺少信息.

P.S. It worked on Visual Studio 2017 too, unfortunately the documentation is poor and lacks information.

这篇关于VS17上的LINK1181链接库失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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