问题描述
我正在尝试在我的一个项目中使用portaudio。不幸的是,我无法编译main.c文件。
错误:“对'Pa_Initialize'的未定义引用” (Pa_Initialize是来自portaudio库的函数)
我的工作目录包括portaudio的.a文件以及portaudio.h。
我当前的gcc命令: gcc main.c libportaudio.a -lm -o main
更新:这些是我main.c中包含的内容。
return new Scaffold(
backgroundColor: Colors.grey[200],appBar: PreferredSize(
preferredSize: const Size(double.infinity,kToolbarHeight * 2),child: SafeArea(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 10.0),child: _searchField()
),),body: new Container(
child: new Column(children: list),bottomNavigationBar: _getBottomNavigationBa(),);
// rest of your code
解决方法
如果出现未定义引用错误,则可能已经集成了头文件portaudio.h
。
正如Kurt E. Clothier所述,您还必须提及gcc命令中的库。根据{{3}},gcc命令为
gcc main.c libportaudio.a -lrt -lm -lasound -ljack -pthread -o main
,
我能够通过重建portaudio库来解决此问题。