简体   繁体   English

使用VS2012编译库时符号名称无效

[英]Invalid symbols name when compiling libraries with VS2012

I compiled libraries with Visual Studio 2012 ( portaudio and opus ), and when I try to use them in a QT project tells me he didn't find the symbols. 我使用Visual Studio 2012portaudioopus )编译了库,当我尝试在QT项目中使用它们时,告诉我他没有找到符号。

However, when I remove the .lib file, I encounter another error saying me that the lib doesn't exist, so the lib is well found. 但是,当我删除.lib文件时,遇到另一个错误,告诉我该lib不存在,因此可以找到该lib。

When doing a dumpbin.exe /SYMBOLS portaudio.lib I have the missing symbols, but with a _ in front of it! 当执行dumpbin.exe /SYMBOLS portaudio.lib我缺少符号,但前面带有_

I don't understand, first time manipulating libraries on Windows and it drives me crazy! 我不明白,第一次在Windows上操作库会使我发疯!

In my .pro I have: 在我的.pro文件中,我有:

win32:LIBS += -L$$PWD
win32:LIBS += -lopus
win32:LIBS += -lporaudio

The problem is that you are mixing 32 and 64 bit. 问题是您要混合使用32位和64位。

The symbol names with an underscore prefix happen to be in 32 bit libraries due to the __cdecl calling convention. 由于__cdecl调用约定,带有下划线前缀的符号名称恰好位于32位库中。 This is not the case with 64 bit libraries where this theory is obsolete. 对于64位库来说,这种理论已经过时了,情况并非如此。

If you wish to build a 32 bit project, build 32 bit portaudio and opus, and configure your project for 32 bit accordingly. 如果要构建32位项目,请构建32位portaudio和opus,然后将项目配置为32位。

If you wish to build a 64 bit project, use 64 bit library dependencies, ie build portaudio and opus so. 如果要构建64位项目,请使用64位库依赖项,即,构建portaudio和opus。 Then make sure that you also have 64 bit project configuration for your own project. 然后,确保您自己的项目还具有64位项目配置。

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

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