gcc对portaudio函数的未定义引用

问题描述

我正在尝试在我的一个项目中使用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库来解决此问题。

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...