Cygwin使用libwebrtc-audio-processing-devel

时间:2017-03-02 11:55:50

标签: c++ cygwin webrtc

我想使用webrtc的VAD模块,在Cygwin上编译。 Cygwin有一些包:packages

我安装了所选的软件包,想要弄清楚如何编译。我已经把我迄今为止尝试过的内容包括在内。我采取了正确的方法吗?或者我应该以不同的方式继续?对于c代码,我是一个业余爱好者。

的main.cpp

int main() {
    AudioProcessing* apm;
}

编译

$ g++ main.cpp
main.cpp: In function ‘int main()’:
main.cpp:3:2: error: ‘AudioProcessing’ was not declared in this scope
  AudioProcessing* apm;
  ^
main.cpp:3:19: error: ‘apm’ was not declared in this scope
  AudioProcessing* apm;

所以我需要包含一些标题并链接一个dll以提供我猜测的实现。

$ ls /usr/include/webrtc_audio_processing/webrtc/
base/            common_types.h   system_wrappers/
common.h         modules/         typedefs.h

$ find / -name "*rtc*dll"
/bin/cygsmartcols-1.dll
/bin/cygwebrtc_audio_processing-1.dll
/usr/bin/cygsmartcols-1.dll
/usr/bin/cygwebrtc_audio_processing-1.dll

我在audio_processing.h中找到了包含类AudioProcessing的标题

的main.cpp

#include "audio_processing.h"
int main() {
    AudioProcessing* apm;
}

编译

$ g++ main.cpp -o main -L/bin/ -lcygwebrtc_audio_processing-1 -I/usr/include/webrtc_audio_processing/webrtc/modules/audio_processing/include/
In file included from main.cpp:1:0:
/usr/include/webrtc_audio_processing/webrtc/modules/audio_processing/include/audio_processing.h:22:35: fatal error: webrtc/base/arraysize.h: No such file or directory
compilation terminated.

很抱歉,如果这看起来很明显,我们都必须从某个地方开始。

讨论结果:

以下结果使用了Cygwin上的libwertc-audio-processing-devel成功编译了一个简单的程序。

$ cat main.cpp
#include "webrtc/modules/audio_processing/include/audio_processing.h"
int main() {
        webrtc::AudioProcessing* apm;
}
$ g++ main.cpp -o main -I/usr/include/webrtc_audio_processing/ -DWEBRTC_WIN -std=gnu++11 -L/bin/ -lcygwebrtc_audio_processing-1

1 个答案:

答案 0 :(得分:1)

查看包内容:

https://cygwin.com/packages/x86_64/libwebrtc-audio-processing-devel/libwebrtc-audio-processing-devel-0.3-1

2016-07-28 08:48           0 usr/include/
2016-07-28 08:48           0 usr/include/webrtc_audio_processing/
2016-07-28 08:48           0 usr/include/webrtc_audio_processing/webrtc/
2016-07-28 08:48           0 usr/include/webrtc_audio_processing/webrtc/base/
2016-07-28 08:48        1190 usr/include/webrtc_audio_processing/webrtc/base/arraysize.h
2016-07-28 08:48        2257 usr/include/webrtc_audio_processing/webrtc/base/basictypes.h
2016-07-28 08:48       10507 usr/include/webrtc_audio_processing/webrtc/base/checks.h
2016-07-28 08:48        1407 usr/include/webrtc_audio_processing/webrtc/base/constructormagic.h
2016-07-28 08:48        3572 usr/include/webrtc_audio_processing/webrtc/base/maybe.h
2016-07-28 08:48        1248 usr/include/webrtc_audio_processing/webrtc/base/platform_file.h
2016-07-28 08:48        3343 usr/include/webrtc_audio_processing/webrtc/common.h
2016-07-28 08:48       27807 usr/include/webrtc_audio_processing/webrtc/common_types.h
2016-07-28 08:48           0 usr/include/webrtc_audio_processing/webrtc/modules/
2016-07-28 08:48           0 usr/include/webrtc_audio_processing/webrtc/modules/audio_processing/
2016-07-28 08:48           0 usr/include/webrtc_audio_processing/webrtc/modules/audio_processing/beamformer/
2016-07-28 08:48        3534 usr/include/webrtc_audio_processing/webrtc/modules/audio_processing/beamformer/array_util.h
2016-07-28 08:48           0 usr/include/webrtc_audio_processing/webrtc/modules/audio_processing/include/
2016-07-28 08:48       38576 usr/include/webrtc_audio_processing/webrtc/modules/audio_processing/include/audio_processing.h
2016-07-28 08:48           0 usr/include/webrtc_audio_processing/webrtc/modules/interface/
2016-07-28 08:48       27021 usr/include/webrtc_audio_processing/webrtc/modules/interface/module_common_types.h
2016-07-28 08:48           0 usr/include/webrtc_audio_processing/webrtc/system_wrappers/
2016-07-28 08:48           0 usr/include/webrtc_audio_processing/webrtc/system_wrappers/include/
2016-07-28 08:48        3706 usr/include/webrtc_audio_processing/webrtc/system_wrappers/include/trace.h
2016-07-28 08:48        3682 usr/include/webrtc_audio_processing/webrtc/typedefs.h
2016-07-28 08:48           0 usr/lib/
2016-07-28 08:48     1360018 usr/lib/libwebrtc_audio_processing.dll.a
2016-07-28 08:48           0 usr/lib/pkgconfig/
2016-07-28 08:48         317 usr/lib/pkgconfig/webrtc-audio-processing.pc

include指令可能只是

-I/usr/include/webrtc_audio_processing