如何用g ++(Ubuntu)编译OpenAL程序? [英] How to compile OpenAL program with g++ (Ubuntu)?

查看:1183
本文介绍了如何用g ++(Ubuntu)编译OpenAL程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图找到一种使OpenAL在我的计算机上工作的方法:

  Ubuntu 12.10 i7 Macbook Pro)

我从终端安装了OpenAL库:

  $ sudo apt-get install libopenal-dev 


$ b b

一切顺利。现在我试图创建一个简单的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:致命错误:AL / alut.h:没有这样的文件或目录
编译终止。有关如何获得OpenAL链接到我的项目的任何想法吗?



我在Google上花了几个小时,答案似乎不存在。我可能做了一些根本错误,因为我是仙女新的Linux c ++开发。

  $ g ++  -  



< lalut test.cpp

  $ g ++ test.cpp -lalut 

解决方案

确保您已经安装了

  sudo apt-get install libalut-dev 


I am trying to find a way of getting OpenAL to work on my computer:

Ubuntu 12.10 (running on 2010 intel i7 Macbook Pro)

I installed the OpenAL library from the terminal:

$ sudo apt-get install libopenal-dev

Everything went well. Now I tried to create a simple C++ program where I include the library:

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

using namespace std;

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

No matter how hard I tried, the closest I came to finding how to compile it with g++ was:

$ g++ test.cpp -lalut 

This gives the following error:

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

Any ideas on how to get OpenAL linked to my projects? I spent hours on Google and the answer doesn't seem to exist. I probably did something fundamentally wrong, since I'm fairy new to Linux c++ development. Thanks.

Edit: changed for reference:

$ g++ -lalut test.cpp

to

$ g++ test.cpp -lalut

(the later is the correct way of doing it, I posted it wrong).

解决方案

Make sure you have alut installed

sudo apt-get install libalut-dev

这篇关于如何用g ++(Ubuntu)编译OpenAL程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆