gpt4 book ai didi

c++ - 无法为 i386 构建 PortAudio 以使其与 NI 的 DAQmxBase 兼容

转载 作者:塔克拉玛干 更新时间:2023-11-03 07:54:47 25 4
gpt4 key购买 nike

我正在尝试编写一个小的 C/C++ 程序,既可以从 NI USB DAQ 获取数据,又可以使用 PortAudio 播放音频。问题是,用于 Mac/Linux 的 NI DAQ 库 DAQmxBase 似乎必须在 i386 下构建,而我无法让 PortAudio 为 i386 构建。

在运行 ./configure --disable-mac-universal && make && make install 之前,我尝试将 CFLAGS 和 LDFLAGS 设置为 -arch=i386,但是 NI当我向其中添加对 PortAudio 的调用时,DAQmxBase 示例代码仍然无法构建:

gcc -I../../includes -g -O2 -arch i386 acAnalogTest.c -framework nidaqmxbase -framework nidaqmxbaselv -o acAnalogTest  
Undefined symbols for architecture i386:
"_Pa_Initialize", referenced from:
_main in ccf1t0bz.o
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status
make: *** [acAnalogTest] Error 1

NI DAQmxBase Makefile 如下所示:

nilibs=-framework nidaqmxbase -framework nidaqmxbaselv                                                              
includes=-I../../includes
flags= -g -O2 -arch i386
cc=gcc

ao_examples = acAnalogTest acquireNScans
......
all : $(ao_examples)

% : %.c
>---$(cc) $(includes) $(flags) $< $(nilibs) -o $@

clean :
>---rm -f $(ao_examples)

更改 DAQmxBase Makefile 中的 -arch 标志不起作用:

gcc -I../../includes -g -O2 -arch x86_64 acAnalogTest.c -framework nidaqmxbase -framework nidaqmxbaselv -o acAnalogTest
In file included from acAnalogTest.c:1:
../../includes/NIDAQmxBase.h:104: warning: division by zero
../../includes/NIDAQmxBase.h:104: error: enumerator value for ‘assert_line_104’ is not an integer constant
../../includes/NIDAQmxBase.h:105: warning: division by zero
../../includes/NIDAQmxBase.h:105: error: enumerator value for ‘assert_line_105’ is not an integer constant
make: *** [acAnalogTest] Error 1

我认为这是因为 DAQmxBase 在编写时考虑到了 i386 数据类型。上述错误引用来自 NIDAQmxBase.h 的行是:

NIStaticAssert(sizeof(long) == 4, "Error: This platform is unsupported because long is not 4 bytes.");              
NIStaticAssert(sizeof(int) == sizeof(long), "Error: This platform is unsupported because int is not the same size as long.");

我可以自己构建一些正常的 PortAudio 示例,但我想将 PortAudio 和 DAQmxBase 放在同一个程序中,让它们相处融洽。必须有一种方法来构建 PortAudio 以便它与 DAQmxBase 一起工作,不是吗?

谢谢!

最佳答案

DAQmx Base 版本 14.0 和 15.0 支持 64 位应用程序,因此您现在应该可以升级驱动程序并重试。

DAQmx Base 15.0 for Mac

关于c++ - 无法为 i386 构建 PortAudio 以使其与 NI 的 DAQmxBase 兼容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21489514/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com