我正在努力将DirectSound实现到一个程序中,但是它需要dsound.h,它需要sal.h,而且无论出于什么原因,我都很难让g++认识到我有sal.h并且它在路径文件中,我甚至可以输入直接命令sal.h,命令提示符就会打开sal.h。但是当我用
g++-3 World.cpp -c
我得到了
dsound.h:13:17: sal.h: No such file or directory.
后面是dound.h中的数千个错误,这些错误都是由sal.h的缺乏引起的。我只是使用记事本、g++和命令提示符,我需要在VC++中工作吗?没有它有什么方法可以使用DirectSound吗?
下面是我正在编译的代码的开头部分,以防万一:
#include "WorldEntity.h"
#include "MBox.h"
#include <D3D9.h>
#include <d3dx9.h>
#include <string>
#include <sstream>
#define _USE_MATH_DEFINES
#include <math.h>
#define KEYDOWN(vk_code)((GetAsyncKeyState(vk_code) & 0x8000) ? 1 : 0)
#define KEYUP(vk_code)((GetAsyncKeyState(vk_code) & 0x8000) ? 0 : 1)
using namespace std;
World::World()
{
//Etc以下是WorldEntity.h的开头,该文件包含dsound.h:
#ifndef WORLDENTITY_H
#define WORLDENTITY_H
class Entity;
class HUD;
#include "Enums.h"
#include "Object.h"
#include "Inventory.h"
#include "AI.h"
#include "Item.h"
#include "Sector.h"
#include "MBox.h"
#include "Particle.h"
#include "Sprite.h"
#include <windows.h>
#include <windows.h>
#include <mmsystem.h>
#include <mmreg.h>
#include <dsound.h>
#include <string>
#include <D3D9.h>
#include <d3dx9.h>
#include <cstdlib>
#include <ctime>
using namespace std;
enum FontIndex
{
//Etc发布于 2012-02-06 06:48:39
命令路径与包含路径不相同。您必须向GCC添加-I标志,以告诉它在哪里可以找到头文件:
g++-3 -IC:\some\path World.cpp -chttps://stackoverflow.com/questions/9154848
复制相似问题