gpt4 book ai didi

c++ - 如何用 g++ (Ubuntu) 编译 OpenAL 程序?

转载 作者:IT王子 更新时间:2023-10-29 00:49:59 30 4
gpt4 key购买 nike

我正在尝试找到一种让 OpenAL 在我的计算机上工作的方法:

Ubuntu 12.10 (running on 2010 intel i7 Macbook Pro)

我从终端安装了 OpenAL 库:

$ sudo apt-get install libopenal-dev

一切顺利。现在我尝试创建一个简单的 C++ 程序,其中包含库:

#include <iostream>
#include <AL/alut.h>

using namespace std;

int main(){
cout << "Hello, world" << endl;
}

无论我多么努力地尝试,我最接近找到如何使用 g++ 编译它的方法是:

$ g++ test.cpp -lalut 

这会产生以下错误:

test.cpp:2:21: fatal error: AL/alut.h: No such file or directory
compilation terminated.

关于如何将 OpenAL 链接到我的项目有什么想法吗?我在谷歌上花了几个小时,答案似乎不存在。我可能做了一些根本性的错误,因为我是 Linux c++ 开发的新手。谢谢。

编辑:更改以供引用:

$ g++ -lalut test.cpp

$ g++ test.cpp -lalut

(后面才是正确的做法,我贴错了)

最佳答案

确保你已经安装了alut

sudo apt-get install libalut-dev

关于c++ - 如何用 g++ (Ubuntu) 编译 OpenAL 程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15452676/

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