0

我正在努力将 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.

其次是由于缺少sal.h而导致dsound.h出现数千个错误。我只是在使用记事本、g++ 和命令提示符,我需要在 VC++ 中才能让 sal.h 工作吗?没有它有什么方法可以使用 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
4

1 回答 1

1

The command path is not the same as the include path. You have to add the -I flag to GCC to tell it where to find header files:

g++-3 -IC:\some\path World.cpp -c
于 2012-02-06T06:48:39.807 回答