在Qt Creator中将错误与第三方库链接

时间:2015-07-07 21:17:43

标签: c++ c linker opus

我需要将pcm数据解码为opus格式。 因此,我想将opus源包含到我的项目中,但我无法链接文件。 我从here下载了源文件opus-1.1.tar.gz。 在Qt Creator中,我将所有文件添加到pro - 文件:

INCLUDEPATH += \
$$PWD/opus/opus/celt \
$$PWD/opus/opus/celt/arm \
$$PWD/opus/opus/celt/tests \
$$PWD/opus/opus/celt/x86 \
$$PWD/opus/opus/silk \
$$PWD/opus/opus/silk/arm \
$$PWD/opus/opus/silk/fixed \
$$PWD/opus/opus/silk/float \
$$PWD/opus/opus/include \
$$PWD/opus/opus/win32

// and here would come an abnormous listing of all c- and h-files of opus:
SOURCES += ... 
HEADERS += ... 

在编译时,我收到来自stack_alloc.h

的警告
#if (!defined (VAR_ARRAYS) && !defined (USE_ALLOCA) && !defined (NONTHREADSAFE_PSEUDOSTACK))
#error "Opus requires one of VAR_ARRAYS, USE_ALLOCA, or NONTHREADSAFE_PSEUDOSTACK be defined to select the temporary allocation mode."
#endif    

例如,USE_ALLOCAconfig.h的{​​{1}}中定义。根据我所见,文件opus/win32仅包含在内:

config.h

但是在源代码附带的文件中,我找不到#ifdef HAVE_CONFIG_H #include "config.h" #endif 。 此外,在文件#define HAVE_CONFIG_H中有一个config.h。该文件也不随源一起提供。我真的不知道如何使用Opus-lib。这可能很难,但我找不到一个最小的例子。

我使用的是Windows 8,mingw和c ++,但该库是c。

1 个答案:

答案 0 :(得分:1)

您可以将-D VAR_ARRAYS添加到编译命令或在头文件中定义:

#define VAR_ARRAYS 1

使用emscripten(WebAssembly)进行构建时,我必须添加以下两个标志:

$ emcc -D VAR_ARRAYS -D OPUS_BUILD ...
相关问题