问题描述
我正在尝试在Visual Studio 2012中编译一个Visual c ++项目,在该项目中,我将通过属性>>链接器>>输入>>其他依赖项向我的项目中添加一个第三方库(libvlc.lib),并添加库目录
I am trying to compile a visual c++ project in Visual Studio 2012 where I am adding a 3rd party library (libvlc.lib) to my project via the Properties >> Linker >> Input >> Additional Dependencies and adding the Library Directories entry in VC++ Directories section.
但是,关于库中存在的API调用,我仍然遇到无法解决的外部符号错误。我不确定自己在做什么错,是否遗漏了一些细节。
However, I am still getting unresolved external symbol errors with regards to the the API calls that exist in the library. I am not sure what I am doing wrong, whether I am missing some details. Any help with regards to this is greatly appreciated.
我还做了一个> dumpbin / EXPORTS libvlc.lib> lib.txt,看看条目是什么,它包含了所有内容。
I also did a > dumpbin /EXPORTS libvlc.lib > lib.txt to see what the entries are and it contains all the API calls.
以下是我的开发环境的屏幕截图:
Here are screenshots of my dev environment:http://imgur.com/s9KiYBp,62TNTYq,pxRcv5u,p5yPf9c
推荐答案
I just had this exact same problem. Posting my results in case someone else does too:
devenv.com c:/Dev/Test/adu/adu.sln / build Development | x64
devenv.com c:/Dev/Test/adu/adu.sln /build "Development|x64"
Microsoft(R)Microsoft Visual Studio 2012版本11.0.61030.0。
版权所有(C)MicrosoftCorp。保留所有权利。
Microsoft (R) Microsoft Visual Studio 2012 Version 11.0.61030.0.Copyright (C) Microsoft Corp. All rights reserved.
1> ------开始构建
:项目:adu,配置:开发x64- ----- 1> adu.obj
:错误LNK2019:
函数主
中引用的未解析的外部符号libvlc_new 1> adu_Development_x64_msd_v110\adu_d.exe:致命
错误LNK1120 :1个未解决的外部变量
1>------ Buildstarted: Project: adu, Configuration: Development x64 ------ 1>adu.obj: error LNK2019: unresolved external symbol libvlc_new referenced infunction main1>adu_Development_x64_msd_v110\adu_d.exe : fatalerror LNK1120: 1 unresolved externals
===========内部版本:0成功,1错误,0最新,0跳过======== ==
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
问题的确(如评论中的@drescherjm所示),我试图链接libvlc.lib的32位版本在64位模式下。 执行32位版本可解决此问题:
The issue was indeed (as @drescherjm suggested in the comments), that I was trying to link a 32-bit build of libvlc.lib in 64-bit mode. Performing a 32-bit build fixed the issue:
devenv.com c:/Dev/Test/adu/adu.sln / build Development | Win32
devenv.com c:/Dev/Test/adu/adu.sln /build "Development|Win32"
Microsoft(R)Microsoft Visual Studio 2012版本11.0.61030.0。
版权所有(C)MicrosoftCorp。保留所有权利。
Microsoft (R) Microsoft Visual Studio 2012 Version 11.0.61030.0.Copyright (C) Microsoft Corp. All rights reserved.
1> ------开始构建
:项目:adu,配置:Development Win32- -----
1>------ Buildstarted: Project: adu, Configuration: Development Win32 ------
1>
adu.vcxproj->
c:\Dev\Test\adu\adu\adu_Development_x86_msd_v110\adu_d.exe
========== Build:1成功,0失败,0 up-迄今为止,已跳过0 ==========
1>adu.vcxproj ->c:\Dev\Test\adu\adu\adu_Development_x86_msd_v110\adu_d.exe========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
这篇关于未解析的外部符号_libvlc_new的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!