sal.h not including when it is in Path

1k views Asked by At

I'm working on implementing DirectSound into a program, but it requires dsound.h which requires sal.h, and for whatever reason I'm having trouble getting g++ to recognize the fact that I have sal.h and it is in the path file and I can even type in the direct command sal.h and command prompt will open sal.h. But when I compile with

g++-3 World.cpp -c

I get

dsound.h:13:17: sal.h: No such file or directory.

followed by thousands of errors from dsound.h resulting from the lack of sal.h. I'm just using notepad, g++, and command prompt, do I need to be in VC++ for sal.h to work? Is there any way to use DirectSound without it?

Here's the opening to the code I'm compiling, just in case:

#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

Here is the beginning of WorldEntity.h, the included file that includes 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
1

There are 1 answers

2
Some programmer dude On

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